Excel 2010 Macro Save AS

robert222

New Member
Joined
Mar 25, 2011
Messages
3
Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p> </o:p>Can anyone help, I am looking for a macro that once run will a copy of the workbook with a name based on the contents of cell AL61 on a sheet named MAIN SHEET but allow the user to specify the path.<o:p></o:p>
I have very little experience with programing. Can anyone help.<o:p></o:p>
 

Some videos you may like

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

DauntingGecko

Well-known Member
Joined
Feb 2, 2006
Messages
521
Code:
Private Sub cmdGetSaveAsName_Click()
Dim save_as As Variant
Dim file_name As String

file_name = Sheets("MAIN SHEET").Range("AL61")

    ' Get the file name.
    save_as = Application.GetSaveAsFilename(file_name, _
        FileFilter:="Excel Files,*.xls,All Files,*.*")
    ' See if the user canceled.
    If save_as = False Then Exit Sub

    ' Save the file with the new name.
    If LCase$(Right$(save_as, 4)) <> ".xls" Then
        file_name = save_as & ".xls"
    End If
    ActiveWorkbook.SaveAs Filename:=save_as
End Sub
 

robert222

New Member
Joined
Mar 25, 2011
Messages
3
Thanks you

That seems to work but does not add a file extension when it saves.

Is there a way to have it save with a .xls or .xlsm extension.

Regards

Robert
 

ghp2017

New Member
Joined
Dec 12, 2017
Messages
46
Hello,
When I use this code .xlsm to the actual file name. What do I need to do to stop that from being added?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,606
Messages
5,597,134
Members
414,128
Latest member
Jorglo

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
Top