![]() |
file won't save!
Any idea why this line of code won't save the file?? The "Save AS" box comes
up the user hits save and the macro contiunes like nothing is wrong. However, the file does not save. The vairable fname, which is the default file name, is working fine! FileSaveName = Application.GetSaveAsFilename(fname, filefilter:="Excel Files (*.xls),*.xls") |
file won't save!
The GetSaveAsFilename does not save the file, it only allows the user to
provide the name of the file to save. After capturing the name with GetSaveAsFilename you have to actually save the file with another line of code. See example below: Sub SaveMe() Dim strName As String 'Variable for filename 'Get the file name by displaying the Save As dialog box strName = Application.GetSaveAsFilename(ActiveWorkbook.Name, _ "Excel Files (*.xls),*.xls") 'Save the file using the name just captured. ActiveWorkbook.SaveAs Filename:=strName End Sub All text prefaced by an apostrophe is a comment... -- Kevin Backmann "Mathew" wrote: Any idea why this line of code won't save the file?? The "Save AS" box comes up the user hits save and the macro contiunes like nothing is wrong. However, the file does not save. The vairable fname, which is the default file name, is working fine! FileSaveName = Application.GetSaveAsFilename(fname, filefilter:="Excel Files (*.xls),*.xls") |
file won't save!
Kevin: thanks! I thought it would simply save the file.
"Kevin B" wrote: The GetSaveAsFilename does not save the file, it only allows the user to provide the name of the file to save. After capturing the name with GetSaveAsFilename you have to actually save the file with another line of code. See example below: Sub SaveMe() Dim strName As String 'Variable for filename 'Get the file name by displaying the Save As dialog box strName = Application.GetSaveAsFilename(ActiveWorkbook.Name, _ "Excel Files (*.xls),*.xls") 'Save the file using the name just captured. ActiveWorkbook.SaveAs Filename:=strName End Sub All text prefaced by an apostrophe is a comment... -- Kevin Backmann "Mathew" wrote: Any idea why this line of code won't save the file?? The "Save AS" box comes up the user hits save and the macro contiunes like nothing is wrong. However, the file does not save. The vairable fname, which is the default file name, is working fine! FileSaveName = Application.GetSaveAsFilename(fname, filefilter:="Excel Files (*.xls),*.xls") |
All times are GMT +1. The time now is 12:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com