xlFileFormat of Office2003/XP

H

Han

Hello

What is xlFileFormat(s) of Office2003 and/or Office XP? I am using
workbook.saveAs() method.

I am seeing the list of the format from VBA document.

Name, Value, Desc
--------------------
xlExcel12, 50, Excel12 'I guess this is Office2007. Right?
xlExcel8, 56, Excel8 'What is 8?
xlExcel9795, Excel9795 'Quite clear for me

I am using Office2007. I want my users of Office2003/XP use the Excel files
saved from my macro of Office2007.
 
H

Han

Thank you very much Ron.

xlExcel8 or 56 is then what I wanted.

Have a nice weekend.
 
R

Ron de Bruin

Hi Han

Use the number ( the new formats ( for example "xlOpenXMLWorkbook") are not known in Excel 97-2003)
When you use the number it compile without errors

When your user is running the macro in 97-2003 it save as -4143

If Val(Application.Version) < 12 Then
'You use Excel 97-2003
FileExtStr = ".xls": FileFormatNum = -4143


When you run the macro in Excel 2007 this number = 56

But if you always run the code in Excel 2007 then you can use xlExcel8
But I like to use the numbers so I can be sure it compile OK in all versions.
 
H

Han

Even more thanks Ron. You are very kind expert.
Sure, I will not use the constant. My macro runs from Jscript. Now I have
written like this.

function convert2(file1) {
try {
var noext=file1.replace(/\.[\s\S]+/, '');
var wbk=exl.workbooks.open("e:\\web\\ox\\uploads\\" + file1);

if (file1.indexOf('.xslx') > 0) {
wbk.saveAs("e:\\web\\ox\\uploads2\\" + noext + ".xls", 56);
}
else {
wbk.saveAs("e:\\web\\ox\\uploads2\\" + noext + ".xlsx", 51);
}

wbk.close(false);
}
catch(e) {
errcount++;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top