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

  • Thread starter Thread starter Guest
  • Start date Start date
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. :-)
 
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.
 
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.
 
Back
Top