Hy guys, I have a problem with the Workbook_BeforeClose.
I wrote a code and I want for every time when I close the file, this file to be saved on a site.
When I open the file myself and closed it is working. But that file is opened from another Excel file to complete cells and here is not working anymore. The Workbook_BeforeClose works only when I open myself the file and is not working if it`s automaticly open and close by another file?
I don`t understand why, because I have Private Sub Workbook_Open() in the file and this is working in the both situations.
Thank you.
Here is the code, if helps:
I wrote a code and I want for every time when I close the file, this file to be saved on a site.
When I open the file myself and closed it is working. But that file is opened from another Excel file to complete cells and here is not working anymore. The Workbook_BeforeClose works only when I open myself the file and is not working if it`s automaticly open and close by another file?
I don`t understand why, because I have Private Sub Workbook_Open() in the file and this is working in the both situations.
Thank you.
Here is the code, if helps:
Code:
rivate Sub Workbook_BeforeClose(Cancel As Boolean)
Dim thefile, thepath As String
Let thepath = "[URL]http://....etc.../[/URL]"
Let thefile = "DatabaseLealde1.xlsm"
ActiveWorkbook.SaveAs Filename:=thepath & thefile _
, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub