.net - Error in opening & repairing word through Powershell script -
i using following powershell script code open , repair corrupted documents.
$word = new-object -comobject word.application $word.visible = $true $word.documents.open($doc, $false, $false, $false, $false, $false, $false, $false, $false, $false, $false, $true, $true) #log opening file log-write -logpath "$logpathfilename" -linevalue "$docleaf - opening file" repairprogress "repair progress $count of $totcnt " "input box contains current file path , name, select , paste save dialog box if neccessary. select checkbox on repair outcome." "$doc" # "repair outcome: $global:outcome " log-write -logpath "$logpathfilename" -linevalue "$docleaf - repair outcome: $global:outcome"`
i have tried giving command below:
$word.documents.open($inputfile, $reffalse, $true, $null, $null, $null, $null, $null, $null, $null, $null, $null, $true, $null, $null, $null)
but open command throws execption "exception calling "open" "13" argument(s): "type mismatch. (exception hresult: 0x80020005 (disp_e_typemismatch))" @ \ad\mynd_gl\profile\jgeo1.ad\desktop\training\do1.ps1:550 char:17 + $word.documents.open($doc, $false, $false, $false, $false, $fals ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : notspecified: (:) [], methodinvocationexception + fullyqualifiederrorid : commethodtargetinvocation"
Comments
Post a Comment