Hi and thanks in advance!
I am using so many Code to do something I think should be easy, BUT I do not why does not WORK.
Nothing works, I am not able to make ThisWorkbook the ACTIVE workbook!!!
ANY HELP
thisworkbook.activate should work but doesn't
Code:
Dim WKBactive As Workbook: Set WKBactive = ActiveWorkbook
Dim wWKBactive As String: wWKBactive = WKBactive.name 'pr wWKBactive = ActiveWorkbook .name
Dim WKBvba As Workbook: Set WKBvba = ThisWorkbook
Dim wWKBvba As String: wWKBvba = ThisWorkbook.Name 'or wWKBvba = WKBvba .name
Dim WKBnew As Workbook: Set WKBnew = ActiveWorkbook
Dim wWKBnew As String: wWKBnew = WKBnew.Name 'or wWKBnew = ActiveWorkbook.name
'For SURE WKBvba and WKBnew are different'
'For sure when running my Macros... WKBnew is the Active workbook, I am opening this File from my PC'
'After doing so many thing thought my Macros using the wKBnew File... '
I would Like to ACTIVATE ThisWorkbook FILE but I CAN'T
I am using so many Code to do something I think should be easy, BUT I do not why does not WORK.
Code:
ThisWorkbook.Activate
WKBvba.Activate
Do Until ActiveWorkbook.Name = ThisWorkbook.Name
ThisWorkbook.Activate
Loop
Application.ScreenUpdating = True
Application.Wait Now() + TimeValue("00:00:04")
If ActiveWorkbook.Name = wWKBvba Then wWKBactive = ThisWorkbook.Name
Err.Clear
ThisWorkbook.Activate
ThisWorkbook.Activate
Workbooks(wWKBvba ).Activate
Windows(wWKBvba).Activate
Do Until (wWKBactive = wWKBvba And Err = 0)
ThisWorkbook.Activate
Workbooks(wWKBvba).Activate
Windows(wWKBvba).Activate
wWKBactive ="" : wWKBactive = ThisWorkbook.name
Loop
Nothing works, I am not able to make ThisWorkbook the ACTIVE workbook!!!
ANY HELP
thisworkbook.activate should work but doesn't