VBA Save As - Excel saves file in 97-2003 format claims file not compatible

question610

New Member
Joined
Jul 3, 2017
Messages
29
I am running a macro where I open a workbook, filter that data, copy and paste that data into a new workbook and save the new workbook.

When I am saving the new workbook(through vba), I get this error:

Microsoft Compatibility Checker
"Minor Loss of Fidelity"
Occurrences: 3
Some cells or styles in this workbook contain formatting that is not supported by the selected file format. These formats will be converted to the closest format available.

It says Excel 97-2003.

When I click continue and try to open the saved file, I get this message
"Excel cannot open the file because the file format or file extension is not valid. Verify that the file has not corrupted and that the file extension matches the format of the file"

I am using Excel 2010.

This is my code

Code:
curr_date = Format(Now(), "mm-dd")
Customer= Sheets("Info").Cells(i, 3).Value
CustomerID = ("Info ").Cells(i, 1).Value
TheFileName = Customer& " " & "Inventory" & " " & curr_date & ".xlsx"


Selection.AutoFilter Field:=4, Criteria1:=CustomerID 
ActiveSheet.AutoFilter.Range.SpecialCells(xlCellTypeVisible).Copy
Workbooks.Add 1
Set NewWbk = ActiveWorkbook
ActiveSheet.Paste
Selection.RowHeight = 15
Selection.Columns.AutoFit


ActiveWorkbook.SaveAs FileName:=Filepath & TheFileName, FileFormat:=xlNormal
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
xlOpenXMLWorkbook51Open XML Workbook

<tbody>
</tbody>
This is the file format for .xlsx workbooks in xl2010 versions. You can use either the bold text name or the 51 numeric code for the FileFormat value.
 
Upvote 0
This is the file format for .xlsx workbooks in xl2010 versions. You can use either the bold text name or the 51 numeric code for the FileFormat value.

WOW! Seriously! It works! Thank you so much!

I honestly would've never been able to figure it out myself!
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,962
Latest member
Fenes

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