How to specify named parameter for Word.Application Close() method RRS feed

  • Question

  • When I'm using the Word.Application to open a document I want to specify parameters for file converstion. However, when I only want to specify the READONLY, FORMAT parameters I have to specify every single parameter until I get to the 10th one.

    Is there any way to pass NAMED parameters like the VBA code samples show on MSDN?

    $pdf = "c:\temp\test.pdf"
    $objWord = New-Object -Com Word.Application
    $objWord.Visible = $true $objDocument = $objWord.Documents.Open($Pdf,$True,$True,$False,"","",$True,"","",22) 

    For example, I would love if it worked like this:

    $objDocument = $objWord.Documents.Open(@{filename=$pdf;ReadyOnly=$True;FileFormat=22})

    Levi Stevens | Technical Consultant Dell Services

    Saturday, March 22, 2014 12:11 AM


All replies