Note that there are some explanatory texts on larger screens.

plurals
  1. POMicrosoft Word Interop automation FilePrintSetup Error
    primarykey
    data
    text
    <p>I am getting "There is a printer error." when tying to send a print job to a printer using automation on Windows 7 with Word 2010. Same code works fine on Windows XP box with Word 2007. I am not sure if Windows 7 or word 2010 is causing the error.</p> <p>Any help appreciated</p> <pre><code>using Microsoft.Office.Interop.Word; ..... object oWordbasic = wordDoc.Application.WordBasic; object[] argValues = new object[] { value, 1 }; //first arg is a printer name String[] argNames = new String[] { "Printer", "DoNotSetAsSysDefault", }; //Error Here oWordbasic.GetType().InvokeMember("FilePrintSetup", System.Reflection.BindingFlags.InvokeMethod, null, oWordbasic, argValues, null, null, argNames); </code></pre> <p>I get the Error Below</p> <pre><code>System.Reflection.TargetInvocationException was caught Message=Exception has been thrown by the target of an invocation. Source=mscorlib StackTrace: at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at PBP.ABC.Framework.Wrappers.Microsoft.Word.WordDocument.set_ActivePrinterName(String value) in InnerException: System.Runtime.InteropServices.COMException HelpLink=wdmain11.chm#24696 Message=There is a printer error. Source=Microsoft Word ErrorCode=-2146827168 InnerException: </code></pre> <p>If I leave out the printer parameters, the invoke work but not printing to the printer specified. It will print to the default printer.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload