Im currently using the below VBA Code in my ThisWorkbook Module of my Main Workbook. The needs to open two other workbooks in background, hidden which enables me to use various other functions. On using the below code, when i open my main workbook, it hides all the windows includeing the one with my main workbook. So i need to manually go and type a code to make this main workbook window visible again. Can you tell me where im going wrong, or even suggest a workaround. I need both the other files open in background hidden. The Register file needs to be editable and should save automatically when i close the Main Workbook.
Dim w As Workbooks
Private Sub Workbook_Open()
Application.ScreenUpdating = True
Set w = Workbooks
w.Open Filename:="I:\Contacts.xlsx", UpdateLinks:=False, ReadOnly:=True
ActiveWindow.Visible = False
w.Open Filename:="I:\Register.xlsx", UpdateLinks:=False, ReadOnly:=False
ActiveWindow.Visible = False
ThisWorkbook.Activate
Application.ScreenUpdating = True
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ScreenUpdating = False
w.Item(2).Saved = True
Workbooks("Register").Save
Application.ScreenUpdating = True
End Sub
Bookmarks