BeforeClose and Workbooks.SaveAs Filename:=
The only thing I can think of that may be the cause of the problem is if the
file was being save with the wrong extension. If the extension was a
reserved extension for system files and on the window explorer you have the
option to hide system files then you wouldn't find the file even though it is
there. Make sure you have the XLS extension on the end of the filename.
"MeistersingerVonNurnberg" wrote:
Hi Joel - Thanks for helping.
1. Yes, I put a beak on the line; highlighted dark red. I get to the line. I
can see the appropriate values in the tooltip. I "Add Watch" - the values are
there. Everything cast properly. The length of the SAVEAS filename is 84.
2. I keep entering a file in the browse under the path the dialog shows. The
file isn't there that for sure. Did a drive search - the file isn't there.
3. Shouldn't matter if it hasn't changed since I am SAVEAS - right? The WB
is set as readonly from the Windows attributes perspective. The point w this
wb is that it shouldn't change which is why I am prompting to save.
This is actually a common proc - this WB save function. It's been alright at
least since last year at this time. Running XL 2002 from Office Pro 2002 and
XP SP3 and IE 7.05xxx
"Joel" wrote:
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.
|