Programming a "Save as..." command button within Excel

G

Guest

Dear all,

I'm generating a spreadsheet, onto which I want to include a button which
prompts the user to "save as.." the current spreadsheet.

I want the spreadsheet to save in .xls format.

This is the code I have currently entered...

Private Sub CommandButton1_Click()
fileSaveName = Application.GetSaveAsFilename(fileFilter:="Microsoft Excel
Workbook (*.xls), *.xls")
End Sub

When I test the button, the "save as..." prompt pops up ok but my saved file
then does not save properly. Everything seems to work ok (no error msgs etc)
but the file just doesn't save in the specified location. It's as if its
vanished into thin air.

Any help/recommendations as to what i'm doing wrong would be greatly
appreciated.

Thanks, David. :)
 
G

Guest

The code you have at the moment is enough to store the save information to a
variable but doesn't save the file. If you add another line such as:-

ActiveWorkbook.SaveAs Filename:=fileSaveName

you should be in business.
 
G

Guest

fantastic - works a treat.

many thanks.

bigwheel said:
The code you have at the moment is enough to store the save information to a
variable but doesn't save the file. If you add another line such as:-

ActiveWorkbook.SaveAs Filename:=fileSaveName

you should be in business.
 

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

Similar Threads

file won't save! 2
Macro to save as 2
command button to save 1
Save as Command Line 1
Save as Msg box 3
Save As 2
Macro to save and close, then copy file 2
Emailing in excel 2003 5

Top