Save .xlsm file as .xlsx used to work but now gives 1004 error

unleashed7

New Member
Joined
Dec 12, 2023
Messages
2
Office Version
  1. 2021
Platform
  1. Windows
Hello, it's my first time here!

I'm stuck on this problem, as they updated Excel recently and can't force save file as default xlsm while it was working before for years.

VBA Code:
ActiveWorkbook.SaveAs "foo", 51

This throws a 1004 error because "VB projects and XLM Sheets cannot be saved in a macro-free workbook".
Disabling alerts also doesn't help, as this is a Run-time error not an alert.

Funny thing is it almost seems like a bug, as if I try to save the file after this error as .xlsx manually the "Save" button literally does nothing, no warning or anything, just doesn't work. I can only save as an xlsm, and if I do save it like that, close excel then REOPEN this saved fuke, suddenly the Save button works for xlsm and asks me if I want to "Save and erase features" which I do.

Is there any way to solve this?
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
One Method :

VBA Code:
Option Explicit

Sub XLSMasXLSX()

Dim newFileFullName As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
newFileFullName = "C:\Users\gagli\OneDrive\Desktop\List.xlsx"

ActiveWorkbook.SaveAs Filename:=newFileFullName, FileFormat _
:=xlOpenXMLWorkbook, CreateBackup:=False

Application.DisplayAlerts = True
Application.ScreenUpdating = True
Workbooks.Open Filename:=newFileFullName
Windows("List.xlsx").Activate


End Sub
 
Upvote 0
It's a change to the dialog involved (there are a few discussions about this going on in this and other forums currently, such as this one). We are still trying to narrow down which versions are affected.
 
Upvote 0
One Method :

VBA Code:
Option Explicit

Sub XLSMasXLSX()

Dim newFileFullName As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
newFileFullName = "C:\Users\gagli\OneDrive\Desktop\List.xlsx"

ActiveWorkbook.SaveAs Filename:=newFileFullName, FileFormat _
:=xlOpenXMLWorkbook, CreateBackup:=False

Application.DisplayAlerts = True
Application.ScreenUpdating = True
Workbooks.Open Filename:=newFileFullName
Windows("List.xlsx").Activate


End Sub

That didn't work unfortunately.

It's a change to the dialog involved (there are a few discussions about this going on in this and other forums currently, such as this one). We are still trying to narrow down which versions are affected.

Thanks for the info! At least now I know why it's not working, that's something 😄
 
Upvote 0
Hi Rory,
I am running O365 and this is most Definity an issue for me. Hence I have removes and intermediate file saving routines from my model. Hope this helps
1704230461334.png
 
Upvote 0
Have you tried
VBA Code:
Workbooks("WorkBook.xlsm").SaveCopyAs "C:\Users\UserName\Documents\FileName.xlsx"
 
Upvote 0
You cannot change file format using savecopyas
 
Upvote 0
You cannot change file format using savecopyas
I thought to myself, after reading this, why would OP want to change formats if they want to save as default xlsx? Then I realized OP was trying to save with a Macro. Duh... My fault :D
 
Upvote 0
I know very little about this but @Skyybot reminded me of something.
If you put the save as code in a seperate workbook will it then let you save the main workbook as xlsx
(ie is it complaining about saving itself without the macro that is actually running the save as)

If that is the case and you need a workaround this might work for you:
 
Upvote 0
I also reported about this error a while ago in another thread:

Strangely enough, this code is again working without an error.
I have Version 2311 (17029.20068).

VBA Code:
Sub Saving()
    Dim strFileName As String

    Application.DisplayAlerts = False
    
    strFileName = ThisWorkbook.Path & "\FileName.xlsx"
    ThisWorkbook.SaveAs Filename:=strFileName, FileFormat:=xlOpenXMLWorkbook
    
    Application.DisplayAlerts = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,109
Members
452,302
Latest member
TaMere

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