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

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


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