Help with Save File Macro

Aussie5380

New Member
Joined
Sep 30, 2022
Messages
32
Office Version
  1. 2019
Platform
  1. Windows
Hi there,

I have a macro written for one of my spreadsheets that saves a copy of the workbook for another staff member to look at, however when the file is saved, it seems to rename the current file in use, and any other data thats entered into the calculator, saves under the information in the calc prior.

Example:

Cal is used to calculate O/payment for John SMITH.

Calc is completed, macro button is hit to save a copy of the file to a staff members save location.

details are then overwritten in the calc (next overpayment is for sally newman)

details are entered for sally, and calc saved again, but it seems to be pulling the info from the last save (with JOHN SMITHS info)

Below is the code i have written. Im just not too sure if i have written something wrong in the macro?

VBA Code:
Sub allow_user_to_select_save_location()

    Dim FileSaveName As String
    Dim fname       As String
ActiveWorkbook.Save
    fname = "Name Here"
    FileSaveName = Application.GetSaveAsFilename(InitialFileName:=fname, filefilter:="Excel Files(*.xlsm),*.xlsm", _
                   Title:="Please Select Location To Save File")
    ActiveWorkbook.SaveAs filename:=FileSaveName, FileFormat:=52
End Sub

i have a feeling it may have to do with the last few lines, specifically "ActiveWorkbook.SaveAs filename:=FileSaveName, FileFormat:=52"?

Any assistance would be greatly appreciated!

Thanks heaps in advance
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
You sir are a gentleman and a scholar! thank you heaps, that's worked perfectly :)
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,122
Members
452,381
Latest member
Nova88

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