How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Dr. Dan Your Own Question
Dr. Dan
Dr. Dan, Computer Software Engineer
Category: Microsoft Office
Satisfied Customers: 1081
Experience:  B.S. Electrical & Computer Engineering, 20+ years technical experience
7043301
Type Your Microsoft Office Question Here...
Dr. Dan is online now
A new question is answered every 9 seconds

what EXCEL xlFileFormat parameter do I use to save an EXCEL

Customer Question

what EXCEL xlFileFormat parameter do I use to save an EXCEL 2007 xlsm file
Submitted: 3 years ago.
Category: Microsoft Office
Expert:  Dr. Dan replied 3 years ago.

Dr. Dan :

Hi my name is XXXXX XXXXX I will be assisting you with your problem today!

Dr. Dan :

This may be an issue between 2003 and 2007

Dr. Dan :

Office 2003 considers Normal xls and not xlsx. In 2007 to save a xlsx file you use the XLworkbookDefault = 51.

Dr. Dan :

Try using SaveAs('c:\test.xlsx', xlWorkbookDefault);

Dr. Dan :

or equivalent for how you have that set up

Dr. Dan :

Let me know if you are now able to open the generated file

Customer: replied 3 years ago.

ActiveWorkbook.SaveAs Filename:= _
template_file, FileFormat:= _
xlWorkbookDefault, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False


 


Message states: "This extension cannot be used with the selected file type"


 


Remember this is an xlsm file

Customer: replied 3 years ago.

Answer did not work.

Expert:  Dr. Dan replied 3 years ago.
Just try using

ActiveWorkbook.SaveAs Application.UserLibraryPath & "Test.xlsx", FileFormat:=51

That will save Test.xlsx in the .xslx format in your User path (sometimes saving to C:\ will be problematic if you need administrative priveleges)
Customer: replied 3 years ago.

So I am thinking the only change you are suggesting is to substitute '51' for the xlFileType property and save to a folder off the root and force the file name to "Test.xlsx".


 


Skip

Expert:  Dr. Dan replied 3 years ago.
It is just a test to see if your save will work for the .xlsx file
Customer: replied 3 years ago.

Works for xlsx......


 


When I run a test with an xlsm file type it fails as follows:


 


Message states: "This extension cannot be used with the selected file type"

Expert:  Dr. Dan replied 3 years ago.
My bad, I forgot you were trying to save to .xlsm, try the following:

ActiveWorkbook.SaveAs Application.UserLibraryPath & "Test.xlsm", FileFormat:=52
Customer: replied 3 years ago.

Dan please read my responses carefully.


 


My last response I told you I ran the test with xlsm and it failed with the following message:


 


Message states: "This extension cannot be used with the selected file type"


 


 


You are starting to waste my time!!!!

Expert:  Dr. Dan replied 3 years ago.
Sorry I can't work with you in a timely manner right now, let me open this up to other experts to see if they can help you more efficiently.
Customer: replied 3 years ago.

52 is the answer

Expert:  Lindie-mod replied 3 years ago.
Hi, I’m a moderator for this topic. It seems the professional has left this conversation. This happens occasionally, and it's usually because the professional thinks that someone else might be a better match for your question. I've been working hard to find a new professional to assist you right away with your excel issue, but sometimes finding the right professional can take a little longer than expected.

I wonder whether you're OK with continuing to wait for an answer. If you are, please let me know and I will continue my search. If not, feel free to let me know and I will cancel this question for you. Thank you!

Lindie
Customer: replied 3 years ago.

Not needed I found the issue and relayed to the last "expert".


 


Never again will I use this service.

Related Microsoft Office Questions