ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Programming a "Save as..." command button within Excel (https://www.excelbanter.com/excel-discussion-misc-queries/118562-programming-save-command-button-within-excel.html)

DavidHawes

Programming a "Save as..." command button within Excel
 
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:="Microso ft 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. :-)

bigwheel

Programming a "Save as..." command button within Excel
 
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.

"DavidHawes" wrote:

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:="Microso ft 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. :-)


DavidHawes

Programming a "Save as..." command button within Excel
 
fantastic - works a treat.

many thanks.

"bigwheel" wrote:

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.

"DavidHawes" wrote:

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:="Microso ft 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. :-)



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

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