1

In order for workbooks to be submitted into a special processing program I am using, the file extension must be .xls. If the workbook has special formatting that is only native to the .xlsx format such as special formatting and such and I just rename the file from .xlsx to .xls, it doesn't seem to have any ill effects other than getting this error:

The file you are trying to open is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?

This is the code I'm using to run the SaveAs:

ActiveWorkbook.SaveAs Filename:=thisWb.Path & "\" & MyNewName, _
FileFormat:=xlExcel12

The common case is that the workbook already has the .xlsx extension, and I change the extension at the time of this VBA SaveAs function. Then, when I open the workbook again, I get the error.

I would like the file to retain the .xlsx features while having the .xls extension and without the error. If there isn't a clean way of doing that, I wouldn't mind just suppressing the error somehow.

Community
  • 1
  • 1
Robby
  • 843
  • 3
  • 19
  • 53
  • What is the "special processing program" that you have? It is the place where warning messages are going to need to be suppressed or, better still, changed to allow it to accept `.xlsx` (or even `.xls*`) extensions. The fact that it is throwing the warning message that it does makes me think it is just an Excel workbook itself. – YowE3K Nov 07 '16 at 19:02
  • It's basically a simple UI for a somewhat extensive bit of VBA code. The problem is that it's locked down as an .exe file, so I can't change that at all unfortunately. I agree that's what needs to be changed though. To be clear, the message I posted above appears upon opening the workbook in Excel because the extension had been manually changed from .xlsx to .xls. It's not a huge deal, but I'd like to keep it from showing up somehow. – Robby Nov 07 '16 at 19:33

1 Answers1

1

xlExcel12 is the .xlsb file extension. I suppose what you really want is the xlExcel8 format which is .xls file extension.

Also see this for further information.

Miqi180
  • 1,670
  • 1
  • 18
  • 20
  • I do want the file to have the .xls file extension, but I also don't want errors about unsupported features. Maybe that is impossible and my problem is to prevent the error message from showing upon opening the workbook. – Robby Nov 07 '16 at 17:54
  • I understand the problem, but I'm not sure it's possible to do that. You could try suppressing alerts in the `Workbook_Open`event with `Application.DisplayAlerts = False`, but that would only work in a macro-enabled workbook. – Miqi180 Nov 07 '16 at 17:59