file won't save!

G

Guest

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")
 
G

Guest

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top