After Saving a ".xlms" With VBA as ".xlsx" Excel Still Asks About Save Without Macros

Shiseiji

Board Regular
Joined
Oct 23, 2009
Messages
214
Office Version
  1. 2019
Platform
  1. Windows
I use the code below to save a my .xlsm as a .xlsx file. However when I save the .xlsx file I still receive a warning about macos in the non-macro enabled workbook. Any assistance is appreciated.
VBA Code:
Sub m_SaveWBasXLSX()
'
    With Application
      .ScreenUpdating = False 'True
      .EnableEvents = True 'False
      .DisplayAlerts = False
      .Calculation = xlManual 'xlCalculationAutomatic
    End With ' Application
    '
    Dim ThisWb As Workbook
    '
    Set ThisWb = ActiveWorkbook
    ChDrive "S:"
    ThisWb.SaveAs "S:\AD_Listing_" & Format(Now, "mm-dd-yyyy_hmmAM/PM") & ".xlsx", FileFormat:=51
    ThisWb.Save
    With Application
      .ScreenUpdating = True 'False
      .EnableEvents = True 'False
      .DisplayAlerts = False
      .Calculation = xlCalculationAutomatic 'xlManual
    End With ' Application

End Sub
 
It's not so much the temp location, that's just good housekeeping for a temporary file that will eventually be deleted. Rather the key is making use of the Workbook object 'SaveCopyAs' method so that you can spawn off a macro-free .xlsx version without affecting, or closing the source workbook containing the macro.
Thanks! As I mentioned , continuous improvement, appreciate your time.

Ron
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,214,943
Messages
6,122,376
Members
449,080
Latest member
Armadillos

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