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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top