VBA to file save as in the format of .xls

ariel20029

Board Regular
Joined
Jun 20, 2013
Messages
97
Hi, I have a macro that generates a Journal entry form and I found a simple code to open the file save as window so my team can rename the file to what ever they want. But I would like to have the format automatically save as an excel file. Is there easy code to do this? I used the simple code below to open the file save as window.
thanks so much,
Sharon


Application.GetSaveAsFilename
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi,

see if this helps.

Code:
    Dim FileSaveName As Variant


    FileSaveName = Application.GetSaveAsFilename(InitialFileName:=ActiveWorkbook.Name, FileFilter:="Excel 2003 (*.xls), *.xls")


    If FileSaveName <> False Then
    
        ActiveWorkbook.SaveAs FileSaveName, FileFormat:=56 'xlExcel8 (97-2003 format xls)
        
    Else
    
        Exit Sub
    
    End If

Dave
 
Upvote 0
Hi,

see if this helps.

Code:
    Dim FileSaveName As Variant


    FileSaveName = Application.GetSaveAsFilename(InitialFileName:=ActiveWorkbook.Name, FileFilter:="Excel 2003 (*.xls), *.xls")


    If FileSaveName <> False Then
    
        ActiveWorkbook.SaveAs FileSaveName, FileFormat:=56 'xlExcel8 (97-2003 format xls)
        
    Else
    
        Exit Sub
    
    End If

Dave

Sorry for the delay in getting back to you... this worked perfectly!!!!
thank you
Sharon
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top