ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   'SaveAs Filename' versus 'GetSaveAsFilename' (https://www.excelbanter.com/excel-programming/421057-saveas-filename-versus-getsaveasfilename.html)

Paige

'SaveAs Filename' versus 'GetSaveAsFilename'
 

Ok, this is probably a really stupid question....but I don't understand the
difference between these two, when you should use one versus the other, and
specifically in terms of how/what they actually save behind the scenes (i.e.,
whether or not they trigger the Workbook_BeforeSave sub). I've read the VBA
help and some other sources, but still am confused. Can someone enlighten me
please?

Bernie Deitrick

'SaveAs Filename' versus 'GetSaveAsFilename'
 
Paige,

GetSaveAsFileName displays a dialog that allows you to either select a folder and/or file or enter a
filename. It, by itself, returns a string, which you can either use as the filename or do other
things with. It has nothing whatsoever to do with actually saving the file.

SaveAs Filename is what actually saves the workbook (as the filename - a string value). The
filename can have a path associated with it, or just be a valid filename, in which case the file is
saved in the current folder.

Most often, they are used together:

ActiveWorkbookSaveAs Application.GetSaveAsFilename

Only the SaveAs triggers the Workbook_BeforeSave sub, and actually will also cause SaveAsUI to be
True.

HTH,
Bernie
MS Excel MVP


"Paige" wrote in message
...
Ok, this is probably a really stupid question....but I don't understand the
difference between these two, when you should use one versus the other, and
specifically in terms of how/what they actually save behind the scenes (i.e.,
whether or not they trigger the Workbook_BeforeSave sub). I've read the VBA
help and some other sources, but still am confused. Can someone enlighten me
please?




Paige

'SaveAs Filename' versus 'GetSaveAsFilename'
 

Thanks for the clarification!!

"Bernie Deitrick" wrote:

Paige,

GetSaveAsFileName displays a dialog that allows you to either select a folder and/or file or enter a
filename. It, by itself, returns a string, which you can either use as the filename or do other
things with. It has nothing whatsoever to do with actually saving the file.

SaveAs Filename is what actually saves the workbook (as the filename - a string value). The
filename can have a path associated with it, or just be a valid filename, in which case the file is
saved in the current folder.

Most often, they are used together:

ActiveWorkbookSaveAs Application.GetSaveAsFilename

Only the SaveAs triggers the Workbook_BeforeSave sub, and actually will also cause SaveAsUI to be
True.

HTH,
Bernie
MS Excel MVP


"Paige" wrote in message
...
Ok, this is probably a really stupid question....but I don't understand the
difference between these two, when you should use one versus the other, and
specifically in terms of how/what they actually save behind the scenes (i.e.,
whether or not they trigger the Workbook_BeforeSave sub). I've read the VBA
help and some other sources, but still am confused. Can someone enlighten me
please?






All times are GMT +1. The time now is 02:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com