1

How can I pass parameters to a com-object function by name rather than by position?

Specifically, I've a com-object function (Word document com-object SaveAs2) and for example I want to pass values to the 2 first parameters and to the last parameter (CompatibilityMode).

  • Don't think it can be done. You can shortcut it somewhat though: $Arglist = "Document.docx",16 + (,$null*14) + 12 – Mathias R. Jessen Feb 16 '15 at 11:25
  • 1
    @MathiasR.Jessen Neat idea, but I'm still hopeful. I've sent this to "The Scripting Guys" as well. – EliadTech Feb 16 '15 at 14:11
1

See this answer on Stackoverflow (short answer - you cannot directly):

https://stackoverflow.com/questions/5544844/how-to-call-a-complex-com-method-from-powershell

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.