GMK Posted March 22, 2012 Share Posted March 22, 2012 I believe it may be a problem with the object returned by _ExcelBookAttach, but I can't confirm that yet. Link to comment Share on other sites More sharing options...
GMK Posted March 22, 2012 Share Posted March 22, 2012 OK, I think I found the problem and modified your original script: #include <IE.au3> #include <Array.au3> #include <Excel.au3> #include <GUIConstantsEx.au3> Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc"); User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite("err.number is: " & @TAB & $oError.number & @CRLF & _ "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ "err.description is: " & @TAB & $oError.description & @CRLF & _ "err.source is: " & @TAB & $oError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ "err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF) EndFunc ;==>_ErrFunc $oExcel = _ExcelBookAttach("C:\Golden Medical Billing\Clients\Dr. Meglio\Aging Reports\2012\Meglio Aging 03-08-12.xlsx") ; Returns the Workbook object, not the application object If @error = 1 Then MsgBox(0, "Error code is: "& @error, "Could not Attach Excel Book returning: " & $oExcel) $oActiveCell = $oExcel.Application.ActiveCell.Value Link to comment Share on other sites More sharing options...
Reg2Post Posted March 22, 2012 Share Posted March 22, 2012 (edited) Nice. Completely overlooked the Application object.Still don't get why _ExcelBookAttach function is being used though. (edit: Must have the Excel file open already and "attaching" $oExcel to the workbook.) Edited March 22, 2012 by Reg2Post Link to comment Share on other sites More sharing options...
GoldenMike Posted March 23, 2012 Author Share Posted March 23, 2012 GMK, That's great. Works perfect w/ Attach now. Thank you so much. Link to comment Share on other sites More sharing options...
GMK Posted March 23, 2012 Share Posted March 23, 2012 You're welcome. Of course, if you continue to use the $oExcel object for other properties and methods, it may be easier to do something like this:$oExcel = _ExcelBookAttach("C:Golden Medical BillingClientsDr. MeglioAging Reports2012Meglio Aging 03-08-12.xlsx") $oExcel = $oExcel.Application $oActiveCell = $oExcel.ActiveCell.Value Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now