Jump to content
JohnOne

_Excel_BookSaveAs

Recommended Posts

JohnOne

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

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
water

The versions of Excel can be found here.

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
JohnOne

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)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
water

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.

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

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
  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

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

×