SaveAs Macro still asks me on exit to save file

JohnZ1156

Board Regular
Joined
Apr 10, 2021
Messages
160
Office Version
  1. 2021
Platform
  1. Windows
I have an Excel Workbook with many sheets. After I enter my new data, I created a button and assigned a macro to save the file to multiple locations. Two "backup" locations and my primary location.
Even though I run the macro and it saves the file, when I go to close the workbook or exit excel, it asks me if I want to save the file again?

Here is my macro.

VBA Code:
Sub SaveAllOver()

    Application.DisplayAlerts = False
    ThisWorkbook.SaveAs "E:\Finance\Finances.xlsm", 52
    ThisWorkbook.SaveAs "Z:\Finance\Finances.xlsm", 52

    'ThisWorkbook.Save
    MsgBox ("The " & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 5) & " Workbook was saved!")
    ThisWorkbook.SaveAs "C:\Users\John\Documents\Finance\Finances.xlsm", 52
    Application.DisplayAlerts = True
        
End Sub
 
If he had originally saved it as xlsb then he would need to use the 52 as it is a change in fileformat

That doesn't mean it originally started as xlsm, he had already saved it using 52 in the original code. What the file started as you don't know.

Anyway this post is diverting away from the main question a bit. @JohnZ1156 please don't miss post number 7 by GWteB.
If the , 52 is needed for his case, just one question: How is he saving the file at all with this code? I get the following error

error message.PNG


when I tried to save a copy of a .xlsb file as .xlsm with the .xlsm in the filePathString and with the , 52 omitted . . . and with Application.DisplayAlerts OFF.)

code.PNG
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Try doing it with an xls file.
Now if you want to discuss this further please start a thread of your, rather than hijacking this thread.

@JohnZ1156 do you have any formulae that include volatile functions?
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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