BeforeClose and Workbooks.SaveAs Filename:=
1) Are you actually getting to the line of code. Put a break point (F9) on
the SAVEAS statement and make sure you are getting to the line
2) How do you know that the file is not getting saved/changed? try
refreshing the window browser you are using to make sure the file isn't
updated or try saving the file under a different name
3) Maybe you workbook hasn't changed since the last time you saved the file.
Make a changed to the worksbook and try running the code again.
"MeistersingerVonNurnberg" wrote:
Hi All -
I've got a function call to save a workbook in the ThisWorkbook BeforeClose.
The function contains the following line:
Workbooks(sWbName).SaveAs Filename:=var_FileName
where, sWbName is a String, which is passed to the function as
ThisWorkbook.Name
and, var_FileName is a local Variant that is set as follows:
var_FileName = Application.GetSaveAsFilename(not showing args)
For whatever reason, the SaveAs line is not working. It raises no Err. Through
the debugger, sWbName is set as the currently opened workbook, and is correct.
Also through the debugger, var_FileName gets set properly by
Application.GetSaveAsFilename(), and contains the full path to the file.
Any ideas? Thanks.
|