Jump to content

_Excel_Export function sheet selection doesn't work


 Share

Recommended Posts

Hi,

I'm a newbie into AutoIt and I'm running into some trouble lately. 

I'm running MS office 2010 and trying to use the _Excel_Export UDF to export a sheet in and excel workbook to a pdf. I keep getting an error = 2 code, which means I'm not declaring my sheet properly. I tried the following:

  • Sheet name: "Simple Invoice Dutch"
  • Sheet number: 1
  • Sheet id: "Sheet1"

The only object selection that works is giving a cell range, which is fine by me if there is another UDF that allows me to activate a certain sheet of an excel workbook. There used to be a function called _ExcelSheetActivate, but since I updated my Autoit installation to the latest version, this function doesn't work anymore. (is not recognised by SciTE

I guess I'm missing out on something important since I've lost a bunch of excel functions with my last update and in return received a few new ones like the export functionality.

Any help would be greatly appreciated. 

I included the file in the attachment.

Auto print invoice Dutch.au3

Link to comment
Share on other sites

Check the Help file for the _Excel_BookOpen function : "@error:    2 - Specified $sFilePath does not exist"

which means "MaxClimbing_facturatie_tool.xlsx" is not in the same folder with the script (as you declared in line 11).

 

 

Link to comment
Share on other sites

It would be better if you could put the code on your post using code tags (<>).   That said, there is an excellent Wiki that Water maintains - it shows all the UDF changes including _ExcelSheetActivate (click to follow the link).  Also, look at the examples for _Excel_RangeRead.  You can reference a sheet from the function:

; ***************************************************************************** 
; Read the formulas of a cell range on sheet 2 of the specified workbook 
; ***************************************************************************** 
Local $aResult = _Excel_RangeRead($oWorkbook, 2, "A1:C1", 2)

Can you post the error message from the Scite console?  Also, what do you see in the console if you add this second line of code?:

Local $sOutput = @DesktopDir & "\" & $sResult & ".pdf"
ConsoleWrite(@crlf&$sOutput&@CRLF)

 

Edited by Jfish

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...