Jump to content

_Excel_BookOpen @error=3, @extended=-2147352567


MB1
 Share

Recommended Posts

I'm trying to open and existing Excel (xlsx) file and the script fails with the following error:

@error=3, @extended=-2147352567

The @error=3 means "Unable to open $sFilePath"

But I can't find where @extended=-2147352567 means.

Does anyone know what this extended error is?

Thanks in advance,

Mark

Link to comment
Share on other sites

Welcome to AutoIt and the forum!

Could you please post the script you run and how you specify the workbook to open?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Here's the script:

#include <MsgBoxConstants.au3>
#include <Excel.au3>
#include <Date.au3>

ConsoleWrite(@LF & "Starting..." & @LF)

Local $oExcel = _Excel_Open()
If @error Then
   ConsoleWrite("Error executing Excel" & @LF)
   Exit 101
EndIf
ConsoleWrite("Created Excel Object." & @LF)

ConsoleWrite("Current directory: " & @WorkingDir & @LF)

Local $sWorkbook = @ScriptDir & "\testfile.xlsx"
ConsoleWrite("@ScriptDir: " & @ScriptDir & @LF)
ConsoleWrite("$sWorkbook: " & $sWorkbook & @LF)

Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook, True)
If @error Then
  ConsoleWrite("Error opening '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended & @LF)
  ; _Excel_Close($oExcel)
  Exit 102
EndIf
ConsoleWrite("Loaded: " & $sWorkbook & @LF)

 

Here's the output:

C:\"Program Files (x86)"\AutoIt3\AutoIt3.exe c:\Forecasting\Excel_Files_For_Mark\OpenExcel3.au3

Starting...
Created Excel Object.
Current directory: C:\Program Files\BMC Software\Control-M Agent\Default
@ScriptDir: c:\Forecasting\Excel_Files_For_Mark
$sWorkbook: c:\Forecasting\Excel_Files_For_Mark\testfile.xlsx
Error opening 'c:\Forecasting\Excel_Files_For_Mark\testfile.xlsx'.
@error = 3, @extended = -2147352567

 

I'm calling the AutoIt3 and script from Control-M.

Thanks,

Mark

Link to comment
Share on other sites

I was able to convince the server admin to run the script as the same user that Control-M is using. The script ran fine. I'm thinking this may be a permissions issue with Control-M and the xlsx file that I'm trying to open. Does -2147352567 indicate a permissions issue or is it just a general, something failed?

Link to comment
Share on other sites

-2147352567 is the decimal value for the hex HRESULT 0x80020009. This stands for: Exception occurred.
So yes: It is a general exception.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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...