gcue Posted July 8 Posted July 8 Hi! I am unable to figure out why i cannot create a workbook. cant find any reference to COM extended error code : -2147023170 Any help is GREATLY appreciated! $oExcel = _Excel_Open(False, False, False, False, True) If @error Then MsgBox($msg_error, $script_name, "Unable to create the Excel application object.") Else ConsoleWrite("success excel open extended: " & @extended) ;here i get "success excel open extended: 1" ;so i know excel wasnt running and the COM object is succesfully created EndIf $oWorkBook = _Excel_BookNew($oExcel, Default) If @error Then $ierror = @error $iextended = @extended ;here i get "Unable to create new workbook. (error: 3 extended: -2147023170)" ;3 - Error returned by method Workbooks.Add. @extended is set to the COM error code ;can't find what that COM extended error code means _Excel_Close($oExcel) MsgBox($msg_error, $script_name, "Unable to create new workbook.") EndIf
Developers Jos Posted July 8 Developers Posted July 8 36 minutes ago, gcue said: cant find any reference to COM extended error code : -2147023170 Took me all but 5 seconds... https://answers.microsoft.com/en-us/msoffice/forum/all/vba-automation-error-2147023170-from-excel/f5fc473f-8271-4c28-89c4-2c64afabb97c 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.
gcue Posted July 8 Author Posted July 8 thanks for looking into it. i didnt see any info on there which was relating to the issue im seeing. not adding any links or anything just creating a new workbook.
water Posted July 8 Posted July 8 (edited) I use the following approach: use the windows calculator to translate -2147023170 (decimal) to 800706BE (hex) use Google to search for "hresult 0x800706BE Excel" Result is something like this: https://www.google.de/search?q=hresult+0x800706BE+Excel Edited July 8 by water ioa747 1 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
rudi Posted Monday at 03:05 PM Posted Monday at 03:05 PM Just as a shot in the dark: I honestly do not know, how the Excel UDF interacts with Exel.exe, but, maybe: For a complete different task with Outlook (powershell) I ran into the issue, that Outlook is opening a "COM-Server", and with that one the PS-Commands interact. Sometimes it did work, next day it didn't. The constraint finally was, that outlook.exe can open such a COM-Server exactly one time within a Windows PC / VM. I used Fast User Switching (FUS), and when I had two logins to this test-PC, and under the login context of "User-A" there was outlook running, then after FUS to user-B the first instance of outlook.exe was not able to create a COM-Server within this user context again, because this is a "one-COM-server-per-PC" thing, not "one-per-user-context". Switching back to user-A, terminate Outlook.exe there, switching again to User-B, everything was working perfectly. argumentum 1 Earth is flat, pigs can fly, and Nuclear Power is SAFE!
Solution gcue Posted Monday at 04:02 PM Author Solution Posted Monday at 04:02 PM Here is what lead me to resolve the issue: originally I had turned off visibility and alerting $oExcel = _Excel_Open(False, False, False, False, True) after i enabled $oExcel = _Excel_Open(True, True, True, False, True) I was able to see the error excel was providing Quote "You are attempting to save a file type that has been blocked by your File Block settings in the Trust Center." Hope this can help someone else! Thank you all for your help
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