Set Active Printer using automation in word for C#

H

HowPK

How to set the active printer in late binding for word.application using C#?

Try the following, cannot work:
Parameters = new Object[2];
Parameters[0] = printername;
Parameters[1] = 1;

String[] argNames = new String[] { "Printer", "DoNotSetAsSysDefault" };

wordApplication.GetType().InvokeMember("FilePrintSetup",
BindingFlags.InvokeMethod, null, wordApplication, Parameters, null, null,
argNames);

Thanks.
 
J

jedrake

How to set the active printer in late binding for word.application using C#?

Try the following, cannot work:
Parameters = new Object[2];
Parameters[0] = printername;
Parameters[1] = 1;

String[] argNames = new String[] { "Printer", "DoNotSetAsSysDefault" };

wordApplication.GetType().InvokeMember("FilePrintSetup",
BindingFlags.InvokeMethod, null, wordApplication, Parameters, null, null,
argNames);

Thanks.

You missed wordApplication.WordBasic that should do it for you.
 
Top