Need help to save all open XLSM to XLSX on either Windows or Mac

randyharris

Board Regular
Joined
Oct 6, 2003
Messages
88
I've been working on this and just can't make any headway.

This needs to run on Windows or Mac platforms, both.

I would like to save all open Excel files which are all XLSM to file type 51, XLSX, closing out each file as it saves.
Do not need to delete the original file, it can remain.
Would like to save the new XLSX version in the same location as the current XLSM file.
Need to bypass any warnings, just want to start the Macro and have it save all the open XLSM files to file type XLSX without VBA code.

Thanks so much for any help.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Trying to get just a single file to save as the new format, can't get it working...

VBA Code:
Sub SaveAsXLSX()
    
    Dim newFileName As String
    Dim wsPath As String
    
    wsPath = Application.ThisWorkbook.Path
    newFileName = ThisWorkbook.FullName
    
    'Test the conditional compiler constant #Mac
    #If Mac Then
    'I am a Mac
    
    #If MAC_OFFICE_VERSION >= 15 Then
    filePermissionCandidates = Array(wsPath)
    fileAccessGranted = GrantAccessToMultipleFiles(filePermissionCandidates)
    #End If

    Application.DisplayAlerts = False
    
    ThisWorkbook.SaveAs FileName:=wsPath & newFileName, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
    ActiveWorkbook.Save
    ActiveWindow.Close

    Application.DisplayAlerts = True

    #Else
    'I am Windows
        MsgBox "Call Windows_Macro"
    #End If

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

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