Jump to content

Recommended Posts

Posted

I'm wondering if there's a known bug with the _Excel_BookOpen function?  I'm using Excel to automate reports.  In short, this program will read through spreadsheets, copy the data from those opened then paste to a master workbook for a remote site.  There are 5 remote sites right now that we need to run these reports on.  I have a function that will read the name of the report, then dump the data into the master workbook.sheets("report name"), concatenate, copy that data to the Users sheet, remove all duplicates and sort, then copy to the Master List sheet in that workbook.  Essentially showing who at that site has access using embedded Excel formulas.  There could be anywhere from 5-20 reports per site.

Regardless of how I set this up, I'm running into the same error:

"C:\Program Files (x86)\AutoIt3\Include\Excel.au3" (227) : ==> Variable must be of type "Object".:
$oExcel.Windows($oWorkbook.Name).Visible = $bVisible
$oExcel.Windows($oWorkbook.Name)^ ERROR

This is pointing back to the _Excel_BookOpen function, however, I cannot find a way around this.  Initially, I thought this may be due to the workbook I was attempting to open, but it is not.  I tested this theory by calling the same function with the same parameters multiple times and received the exact same output.  It will run through for the first 3 function calls, but when it gets to Site4, it fails 3 reports in.  Memory usage and processor usage are normal and are not spiking and nomenclatures are correct.  I am also clearing the clipboard in between calls.  I have included a snippet of the code, but due to company policy, I cannot include any of the excel documents.  I know this is long winded, but any suggestions would be greatly appreciated.

reports.au3

Posted

There is a pinned thread at the top of the General Help and Support forum. It contains fixed versions of some Excel functions. 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

Posted

The updates seem to have taken care of the initial problem.  However now, it's failing when calling the _Excel_RangeRead during the 4th function call, even when using the same workbook.  Any suggestions?

 

someprogram_Test.au3" (289) : ==> The requested action with this object has failed.:
$numList = _Excel_RangeRead($mWorkbook, $mWorkbook.Sheets("Users"))
$numList = _Excel_RangeRead($mWorkbook, $mWorkbook^ ERROR

Posted

I ended up finding a workaround though it's not preferable.  I had to compile each function into a separate .exe files.  Doing this and having the initial script calling these separate .exe files appears to work.  It is a little slower, but it works.  I'll keep a look out for future Excel updates.  Thanks again for your help.

Posted

You could add a COM error handler to your script and check the detailed error Information you get.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

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