Hi all!
I have an issue with closing the workbook with macro code after being open with Private Sub Workbook_Open () command. How should code be adjusted to close the workbook after executing rest of the modules? At the moment all macros are working well (SAP_Login, SAP_Extract, SAP_Logout) only Close_Excel command doesn't work and workbook remains open.
My code:
Private Sub Workbook_Open()
Call SAP_Login
Call SAP_Extract
Call SAP_Logout
Call Close_Excel
End Sub
------------------------------------------------------
Sub Close_Excel()
ThisWorkbook.Close SaveChanges:=False
End Sub
I have an issue with closing the workbook with macro code after being open with Private Sub Workbook_Open () command. How should code be adjusted to close the workbook after executing rest of the modules? At the moment all macros are working well (SAP_Login, SAP_Extract, SAP_Logout) only Close_Excel command doesn't work and workbook remains open.
My code:
Private Sub Workbook_Open()
Call SAP_Login
Call SAP_Extract
Call SAP_Logout
Call Close_Excel
End Sub
------------------------------------------------------
Sub Close_Excel()
ThisWorkbook.Close SaveChanges:=False
End Sub