Saving Files using VBA - xlsx format not working correctely

Cat129

Board Regular
Joined
Oct 20, 2012
Messages
96
I have googled, and sorry if I am missing something obvious. When I use the code below, it is saving itself as as an older version of Excel and I am loosing formatting.

What extension do I need to use to save it as the most recent version? I have made the error message go away with the display alert toggle, but this doesn't actually fix the issue :cautious:

VBA Code:
Dim MyFileName As String
Dim SaveFolder As String
Dim FPathName As String

Application.DisplayAlerts = False

MyFileName = "Change Request - " & Range("C2") & " " & Range("C3")
SaveFolder = "C:\Temp"
FPathName = SaveFolder & "\" & MyFileName & ".xlsx"


ActiveWorkbook.SaveAs Filename:=FPathName, FileFormat:=xlNormal
Application.DisplayAlerts = True
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Do you need it to be macro enabled?
 
Upvote 0
In that case try
VBA Code:
Dim MyFileName As String
Dim SaveFolder As String
Dim FPathName As String

Application.DisplayAlerts = False

MyFileName = "Change Request - " & Range("C2") & " " & Range("C3")
SaveFolder = "C:\Temp"
FPathName = SaveFolder & "\" & MyFileName & ".xlsm"


ActiveWorkbook.SaveAs FileName:=FPathName, FileFormat:=52
Application.DisplayAlerts = True
 
Upvote 0
In that case try
VBA Code:
Dim MyFileName As String
Dim SaveFolder As String
Dim FPathName As String

Application.DisplayAlerts = False

MyFileName = "Change Request - " & Range("C2") & " " & Range("C3")
SaveFolder = "C:\Temp"
FPathName = SaveFolder & "\" & MyFileName & ".xlsm"


ActiveWorkbook.SaveAs FileName:=FPathName, FileFormat:=52
Application.DisplayAlerts = True
Perfection! Thank you
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,946
Messages
6,122,401
Members
449,081
Latest member
JAMES KECULAH

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