Jump to content

Word script broke with 3.3.14.2


dbaron4
 Share

Recommended Posts

The following script which is supposed to update the Word document file properties (including the calculated page numbers in the document file properties) works in 3.3.12.0 but fails with a COM error in 3.3.14.2. The error I get is 80020006 - Unknown Name:

#include <Word.au3>

$oWordApp = _Word_Create(1)
$oDoc = _Word_DocOpen($oWordApp, "C:\TEMP9\IN\Master - RS15P05 - Notes Summary.docx")
$objErr = ObjEvent("AutoIt.Error", "MyErrFunc") ; Install a custom error handler
$oDoc.Update ; RESULTS IN COM ERROR 80020006 - UNKNOWN NAME
$objErr = 0 ;disable custom error handler
Exit

Func MyErrFunc()
    $hexnum = hex($objErr.number, 8)
    $SQLErr = $objErr.description
    SetError(1)
    $msg = "COM error detected!"                     & @CRLF & @CRLF & _
           "Error description: "    & $objErr.description    & @CRLF & _
           "Error windescription: " & $objErr.windescription & @CRLF & _
           "Error lastdllerror: "   & $objErr.lastdllerror   & @CRLF & _
           "Error scriptline: "     & $objErr.scriptline     & @CRLF & _
           "Error number: "         & $hexnum                & @CRLF & _
           "Error source: "         & $objErr.source         & @CRLF & _
           "Error helpfile: "       & $objErr.helpfile       & @CRLF & _
           "Error helpcontext: "    & $objErr.helpcontext
    MsgBox(16, "Error", $msg)
    If IsObj($oDoc) Then _Word_DocClose($oDoc)
    If IsObj($oWordApp) Then _Word_Quit($oWordApp)
    Exit
EndFunc   ;==>MyErrFunc

Should the Word document file properties be updated (page numbers recalculated) in a different manner?

Link to comment
Share on other sites

Which version of Office do you run?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

I just checked the Word 2010 reference. There is no Update method for the document object. Do you mean the UpdateSummaryProperties method?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

That's true. On Word 2013 method UpdateSummaryProperties is no longer available.

You could activate the macro recorder in Word, do what you need to do manually, stop the recorder and post the resulting VBA code. Should be easy to translate to AutoIt.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

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