maniootek Posted August 27, 2017 Share Posted August 27, 2017 When I run this code I got COM error. #include <Excel.au3> Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Local $oExcel = _Excel_Open() Func _ErrFunc($oError) local $message $message &= "COM Error!" & @CRLF & @CRLF $message &= "scriptname: " & @ScriptName & @CRLF & @CRLF $message &= "number: " & $oError.number & @CRLF $message &= "windescription: " & $oError.windescription & @CRLF $message &= "source: " & $oError.source & @CRLF $message &= "description: " & $oError.description & @CRLF $message &= "helpfile: " & $oError.helpfile & @CRLF $message &= "helpcontext: " & $oError.helpcontext & @CRLF $message &= "lastdllerror: " & $oError.lastdllerror & @CRLF $message &= "scriptline: " & $oError.scriptline & @CRLF MsgBox(16, @ScriptName, $message) EndFunc Any idea what is wrong? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 27, 2017 Developers Share Posted August 27, 2017 (edited) Care to share what that error is or do you want us to guess? Jos Edited August 27, 2017 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
water Posted August 27, 2017 Share Posted August 27, 2017 (edited) Works as designed! _Excel_Open tries to connect to an already running instance of Excel. If there is none you get a COM error. This error is handled by _Excel_Open, which means that the function then starts a new instance of Excel. Added: if you run the latest version of AutoIt then there is no need for a COM error handler in the main script as each UDF function calls its own COM error handler. Edited August 27, 2017 by water Description how the latest version of AutoIt handles COM errors. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
maniootek Posted August 28, 2017 Author Share Posted August 28, 2017 (edited) 10 hours ago, Jos said: Care to share what that error is or do you want us to guess? Jos sorry for that, COM error just show "scriptline 65" error, nothing more 10 hours ago, water said: Works as designed! _Excel_Open tries to connect to an already running instance of Excel. If there is none you get a COM error. This error is handled by _Excel_Open, which means that the function then starts a new instance of Excel. Added: if you run the latest version of AutoIt then there is no need for a COM error handler in the main script as each UDF function calls its own COM error handler. thank you for information. Now I used this code: _Excel_Open(default, default, default, default, True) and there is no more com error Edited August 28, 2017 by maniootek Link to comment Share on other sites More sharing options...
maniootek Posted November 6, 2017 Author Share Posted November 6, 2017 On 27.08.2017 at 10:07 PM, water said: Added: if you run the latest version of AutoIt then there is no need for a COM error handler in the main script as each UDF function calls its own COM error handler. Can you give me more information about this? Link to comment Share on other sites More sharing options...
Danyfirex Posted November 6, 2017 Share Posted November 6, 2017 8 minutes ago, maniootek said: Can you give me more information about this? Check this function __Excel_COMErrFunc inside Excel UDF also read about ObjEvent. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut 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