Jump to content

Can't get _excel_bookattach to work anymore


Recommended Posts

My script below was working as of last week but now the book won't attach.  The first error code is 1 for the book attach, @extended = -2147352570.  When I do the rangeread, it confirms the first error code with a 1 return.

I do have two excel sheets running but I didn't think it would matter because the book was attached to the file I want.  I've read the help file, tried the example scripts, even had this script working but now its broken.

My autoit is up to date.  Any ideals?  Thanks.

 

 

#include <Misc.au3>
#include <Excel.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>
#include <MsgBoxConstants.au3>


AutoItSetOption("WinTitleMatchMode", 2)
WinActivate("Morning IND")
Global $sWorkbook = @DesktopDir & "\Morning IND.xls"
Global $oExcel = _Excel_BookAttach($sWorkbook) ; Path to excel file that is on the desktop
If @error Then  MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 2", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Global $var1 = _Excel_RangeRead($oExcel, Default, "X47") ; Symbol from X1
If @error Then  MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 2", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

 

Link to comment
Share on other sites

If it worked and now it doesn't then something has changed:

  • The script code
  • The Excel workbook (name, directory where it is stored)
  • New version of AutoIt installed
  • New version of Excel installed
  • ...
     

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

  • 3 weeks later...
On 4/7/2016 at 5:41 PM, water said:

I know this is an old thread but I wanted to thank water for the help.  I indeed messed up the directory and a couple other minor things.  Now I open everything in the correct order and it all works.  Thanks for making me double check the simple stuff.

 

Link to comment
Share on other sites

:) Glad it is again working now and that the problem was not caused by the Excel UDF (bug or whatever).

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

×
×
  • Create New...