.net – Setting Word’s printer through Office automation

automationms-officenet

I'm looking to do the same as in this question here, however I am developing in a .NET class library, referencing the Primary Interop Assemblies.

The item returned from the dialog box collection when I do this

wordApp.Dialogs[WdWordDialog.wdDialogFilePrintSetup]

does not expose properties such as Printer and DoNotSetAsSysDefault. Does anyone know why I can't get at these properties, or is there a better way altogether of switching which printer Word will use?

Best Answer

In Delphi I store the returned dialog box in a Variant and then access the properties. Delphi then automatically calls the appropriate methods from the IDispatch interface to access those properties.

So I am using late binding to access the properties of the dialogbox. I'm not familiar with your language, but late binding should be possible I think.