У меня две рабочие тетради.В первом я вызываю макрос, который активирует другой, и берет оттуда несколько данных.Затем он открывает пользовательскую форму, где он запускает макрос при нажатии кнопки ОК.В данный момент функция ThisWorkbook.Activate не работает.ActiveWorkbook.Name остается другим.Но когда макрос останавливается, книга Activework поворачивается правильно.Почему это может случиться(У меня не было этой проблемы в более старой версии Excel, которую я имел)
Я попытался изменить обновление экрана.Я пытался подождать время до и после активации.Я пытался снять защиту листа.Я понятия не имею, что делать.
Private Sub btOK_Click()
'Application.ScreenUpdating = True
Me.Hide
Plan_Inser_Ativ = ValorVariavel("Plan_Inser_Ativ") 'Function to Take a recorded text of Sheet Name (This is working)
ThisWorkbook.Unprotect
ThisWorkbook.Sheets(Plan_Inser_Ativ).Activate 'I tried to activate the workbook by this method, but this is not working
ThisWorkbook.Activate 'I tried to activate by this other method, but this is not working too
'Application.Wait (Now + TimeValue("0:00:03"))
ThisWorkbook.Activate 'I tried to insist in it to see what happens :-)
WB_Ativa = ActiveWorkbook.Name 'The WB_Ativa variable remains with the other Workbook name.
Stop 'When the macro stops, if I place the mouse over the ActiveWorkbook.Name statement, it shows that the active Workbook is correct. But before the macro to stop, it was not.`
..
..
..
