VB Save As non-Macro enabled workbook

Mcook13

New Member
Joined
May 14, 2019
Messages
43
I have been running the same VB code for years and have not run into any errors where my macro enabled workbook performs a Save As, as a non-macro enabled workbook or xlsx.

Now I get the error, "VB projects and XLM Sheets cannot be saved in a macro-free workbook."

I cannot figure out what is causing the error.

Below is my code. Any help is appreciated as to why now I cannot save as and receive the error.

VBA Code:
Sub UpdateOOR()

    Application.DisplayAlerts = False
    ActiveWorkbook.Worksheets("OOR").ListObjects("MTs_SG_OOR").QueryTable.Refresh BackgroundQuery:=False
    Cells.Select
    Cells.EntireRow.AutoFit
    ActiveWorkbook.Save
    For Each Shp In ActiveSheet.Shapes
      Shp.Delete
    Next Shp
    Range("B:D").EntireColumn.Hidden = True
    Range("I:I").EntireColumn.Hidden = True
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Customer New\SG\3009 SG (60000009ES) Plastic Fittings\7. Status Reports (SR)\Open Order Reports\2023\" & "SG Plastics OPEN ORDER REPORT " & Format(Now, "mm.dd.yy") & ".xlsx", FileFormat:=51
    Application.DisplayAlerts = True
End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
There are a few other threads open on this at the moment. The issue is caused by a new dialog that pops up when doing this. The old one defaulted to Yes which the displayalerts = false would effectivelly click. The new one defaults to 'Go Back' which then causes the error. It's not clear whether this is a temporary change (there doesn't appear to be a lot of logic currently as to who is affected).
 
Upvote 0
There are a few other threads open on this at the moment. The issue is caused by a new dialog that pops up when doing this. The old one defaulted to Yes which the displayalerts = false would effectivelly click. The new one defaults to 'Go Back' which then causes the error. It's not clear whether this is a temporary change (there doesn't appear to be a lot of logic currently as to who is affected).
How do I go about modifying my code to then proceed with saving as a non-macro (.xlsx) workbook?
 
Upvote 0
Do you have any code in the worksheets' or thisworkbook modules?
 
Upvote 0
Do you have any code in the worksheets' or thisworkbook modules?
This is my code.

VBA Code:
Sub UpdateOOR()


    Application.DisplayAlerts = False
    ActiveWorkbook.Worksheets("OOR").ListObjects("MTs_SG_OOR").QueryTable.Refresh BackgroundQuery:=False
    Cells.Select
    Cells.EntireRow.AutoFit
    ActiveWorkbook.Save
    For Each Shp In ActiveSheet.Shapes
      Shp.Delete
    Next Shp
    Range("B:D").EntireColumn.Hidden = True
    Range("I:I").EntireColumn.Hidden = True
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:= _
        "P:\Customer New\SG\3009 SG (60000009ES) Plastic Fittings\7. Status Reports (SR)\Open Order Reports\2023\" & "SG Plastics OPEN ORDER REPORT " & Format(Now, "mm.dd.yy") & ".xlsx", FileFormat:=51
    Application.DisplayAlerts = True
End Sub
 
Upvote 0
If that's the only code, you could probably just copy all the sheets to a new workbook (using activeworkbook.sheets.copy) and then save the new active workbook instead?
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,963
Members
449,094
Latest member
Anshu121

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