I have a Sub Workbook_Open() routine that when I include
statement, the "WkBkView" workbook happily opens but the macro workbook Saved state gets set to False.
What's weird is despite setting the macro workbook state back to True on the next line, it immediately still reports False. If comment out the Open statement this does not occur.
My code at this point ..
and the resultant prints ..
2: False .. TEST Update.xlsm =? TEST Update.xlsm.
3: False .. TEST Update.xlsm =? TEST Update.xlsm.
PS: using ThisWorkbook.Saved behaves exactly the same.
What is causing this behaviour, and how can I avoid it?
VBA Code:
Workbooks.Open ThisWorkbook.Path & "\" & WkBkView
What's weird is despite setting the macro workbook state back to True on the next line, it immediately still reports False. If comment out the Open statement this does not occur.
My code at this point ..
VBA Code:
Debug.Print "2: " & Workbooks(MyWorkBookName).Saved & " .. " & MyWorkBookName & " =? " & ThisWorkbook.Name & "."
Workbooks(MyWorkBookName).Saved = True
Debug.Print "3: " & Workbooks(MyWorkBookName).Saved & " .. " & MyWorkBookName & " =? " & ThisWorkbook.Name & "."
2: False .. TEST Update.xlsm =? TEST Update.xlsm.
3: False .. TEST Update.xlsm =? TEST Update.xlsm.
PS: using ThisWorkbook.Saved behaves exactly the same.
What is causing this behaviour, and how can I avoid it?