brettacook
New Member
- Joined
- Feb 11, 2017
- Messages
- 9
I have this interesting behavior that I'd like to see if I can avoid. I'm using Excel 2016.
When the the code executes the 'Set ResultWorkbook = Workbooks.Open(WorkbookName)' line, the value of 'YearWorkbook.Saved' goes to False (it should be True because there have been no modifications to that workbook).
Has anyone seen this behavior before? And if so, is there an explanation for this behavior and/or a workaround? (Or, is there some obvious coding error that I've made?)
Thanks!
Code:
Set YearWorkbook = Workbooks.Open("Generator.xlsm")
Dim DescriptionsWorkbook As Workbook
Set DescriptionsWorkbook = YearWorkbook
Dim DescriptionWorksheet As Worksheet
Set DescriptionWorksheet = DescriptionsWorkbook.Worksheets("Descriptions")
Dim EventSheet As Worksheet
Set EventSheet = YearWorkbook.Worksheets("Events")
Dim WorkbookName As String
WorkbookName = "Results.xlsx"
On Error Resume Next
Dim ResultWorkbook As Workbook
Set ResultWorkbook = Workbooks.Open(WorkbookName)
On Error GoTo 0
....
When the the code executes the 'Set ResultWorkbook = Workbooks.Open(WorkbookName)' line, the value of 'YearWorkbook.Saved' goes to False (it should be True because there have been no modifications to that workbook).
Has anyone seen this behavior before? And if so, is there an explanation for this behavior and/or a workaround? (Or, is there some obvious coding error that I've made?)
Thanks!