Excel: Create a File SaveAs macro


Question:  I'd like to create a "Save As" macro in Excel that I can assign to a button. This macro should let me save my Excel spreadsheet while allowing me to select the file name.


How can I do this?


Answer:  The following macro will perform a "File Save As" and then display a message box stating where the file was saved to.


Macro Code:

The macro code looks like this:

Sub mcrSave()

    'Retrieve file name to use for Save
    fileSaveName = Application.GetSaveAsFilename( _
        fileFilter:="Excel Files (*.xls), *.xls")

    'If user specified file name, perform Save and display msgbox
    If fileSaveName <> False Then
        ActiveWorkbook.SaveAs Filename:=fileSaveName, FileFormat:=xlNormal

        MsgBox "Save as " & fileSaveName
    End If


End Sub

Spreadsheet News


Book Shop


Visit our busy book shop, were you can find latest books for beginners as well as advanced excel users.



Software Library




Spreadsheet123

Spreadsheet 123 Spreadsheet Software Development

Home | About Us | Our Services | Software | Spreadsheets Library | Excel Tutorials | Useful Links | Site Map | Contact Us
Home
About Us
About Spreadsheet
Book Shop
Excel Tutorials
1
Spreadsheets Library
3
4
5
6
Our Services
8
Site Map
Software
11
12
13
14
15
16
17