How to fix an Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
HI,
Started with a .docm template document , I'm invoking, from Powershell , Word to update fields read from a .csv to update letters sent to a lot of destinees , by the way of a VBA macro , then the .docx generated document is in a .pdf.
Then ,I got following error when invoking the macro ( as a consequence ,the .docx file isn't generated):
HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
Word call within powershell script :
$WORD.Documents.Open($DOCMACRO , $false, $false, $false, "", "", $true, "", "", 12, $null, $true, $false, 0, $false)
*$APP = $WORD.Application*
*$APP.Run($MACRO, $CSVVAR, $REPWORK, $DOCWORDPU)*
*}*
Macro used is this one :
Sub Macro1(CSV, WORK, PUBLISH)
'
' Macro1 Macro
'
'
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
*ActiveDocument.MailMerge.OpenDataSource Name:= _*
*CSV, ConfirmConversions:=False, ReadOnly:= _*
*False, LinkToSource:=True, AddToRecentFiles:=False, PasswordDocument:="", _*
*PasswordTemplate:="", WritePasswordDocument:="", WritePasswordTemplate:= _*
*"", Revert:=False, Format:=wdOpenFormatAuto, Connection:="", SQLStatement _*
*:="", SQLStatement1:="", SubType:=wdMergeSubTypeOther*
*With ActiveDocument.MailMerge*
*.Destination = wdSendToNewDocument*
*.SuppressBlankLines = True*
*With .DataSource*
*.FirstRecord = wdDefaultFirstRecord*
*.LastRecord = wdDefaultLastRecord*
*End With*
*.Execute Pause:=False*
*End With*
*ChangeFileOpenDirectory WORK*
*ActiveDocument.SaveAs2 FileName:=PUBLISH, FileFormat:= _*
*wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles _*
*:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts _*
*:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _*
*SaveAsAOCELetter:=False, CompatibilityMode:=15*
*ActiveWindow.Close*
End Sub
I'm not expert in these domains , any idea to avoid to follow a bad track is welcome ^^
Thx for help.
J.P.