Jump to content
JohnOne

_Excel_BookSaveAs

Recommended Posts

Below is a quote from the helpfile.

 

 

Starting with Excel 2007 you have to provide both the $iFormat parameter and the correct file extension in $sFilePath.

 

My question is, how do I know what extension a user will need?

For example I have excel version 15 as reported by.

$oExcel.Version

But what version is pre 2007, does the number correspond to the year, for instance if I had excel 2006, would the above code produce 6?

EDIT:

Because I'd like to use $xlWorkbookDefault " Workbook default (.xls for < Excel 2007, .xlsx for > Excel 2007)"

Edited by JohnOne

Share this post


Link to post
Share on other sites

The versions of Excel can be found here.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-10-09 - Version 0.9.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks, so would you say this will suffice?

Local $ext = "xls"
If $oAppl.Version >= 12 Then
    $ext = "xlsx"
EndIf
_Excel_BookSaveAs($oWorkbook, @ScriptDir & "\catalog." & $ext, $xlWorkbookDefault)

Share this post


Link to post
Share on other sites

If the content of the workbook doesn't change based on the used Excel version, then I would always save it as XLS. All Excels versions understand the XLS file format. No need to create XLSX files for newer versions.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-10-09 - Version 0.9.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Never had a problem with XLS files.

XLS files are in a binary format whereas XLSX files are ZIP-compressed XML files.

I suggest to use XLS.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-10-09 - Version 0.9.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...