Jump to content

$oExcel = _ExcelBookOpen stopped working suddenly


Recommended Posts

This morning I came in and a script i have been using for several years suddenly stopped working.  Windows 7 64 bit, a new laptop but the script did work on this laptop before today.  The script finds the most recent morning report in XLS format and then copies several columns to an array for usage later on.  I wrote this using the Excel.AU3 referenced below, when Excel.AU3 was updated, I renamed the older version and used it without issue.

; Title .........: Microsoft Excel COM UDF library for AutoIt v3
; AutoIt Version : 3.2.3++, Excel.au3 v 1.5 (07/18/2008 @ 8:25am PST)

When I open the AU3 file it crashes in the _ExcelBookOpen in this step If .ActiveWorkbook.Sheets($i).Visible = $xlSheetVisible Then.  I figured that out by inserting a bunch of consolewrite commands at each step.

When I retrieved the relevant lines of code from my script and insert into a new AU3 file shown below it runs flawlessly each time.

Any suggestions on where to go to troubleshoot this?

 

#include <ExcelOld.au3>
#include <array.au3>
$LFTServiceFileName = "c:\temp\riglocations\LFT20161218UserReport_BoucDavW_DailyUpdate.xls"
$oExcel = _ExcelBookOpen($LFTServiceFileName, 0)
$aDailyActivityList = _ExcelReadSheetToArray($oExcel, 9, 2, 0, 8)
_ArrayDisplay($aDailyActivityList)
 

ExcelOld.au3

Link to comment
Share on other sites

  • Moderators

Perhaps it would be easier (to get assistance, I mean) if you just bite the bullet and convert your code to the current UDF rather than trying to resuscitate the old. Your code above would translate something like this (pseudo):

#include <Array.au3>
#include <Excel.au3>

Local $oExcel, $oWorkbook, $oRange

$oExcel = _Excel_Open()
$oWorkbook = _Excel_BookOpen($oExcel, "c:\temp\riglocations\LFT20161218UserReport_BoucDavW_DailyUpdate.xls")
    If IsObj($oWorkbook) Then
        $oRange = _Excel_RangeRead($oWorkbook, Default, "I9:I20")
        _ArrayDisplay($oRange)
    EndIf

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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