views:

137

answers:

2

Hi StackOverflow,

We have C# code in a PowerPoint Addin for custom printing. In Office 2003,

SendKeys.Send("^+{F12}");

works fine to bring up the Print Dialog after doing some stuff.

But in Office 2007 it does not, instead just sending the document to the printer without the dialog.

Getting the Dialog is very important.

using "^{p}" or "^p" as the string will acheive the same thing, no dialog.

Executing the command via:

Application.CommandBars.ExecuteMso("FilePrint");

will also acheive the same thing, no dialog.

Any clues, tips or suggestions as to how can I may get the Print Dialog to appear would be most appreciated.

A: 

Take a look here: power point printing problem using C#

Rubens Farias
Thanks for the reference. The suggestion here is to use:PrintOptions.PrintInBackground = Microsoft.Office.Core.MsoTriState.msoFalse; In my case, this causes a progress window to appear showing which pages are printing, but does not cause the Print Dialog to appear,
Richard Collins
A: 

For the record, here's how I was able to eventually get this working, but i dont fully understand why.

three things required (all necessary)
- use ExecuteMso instead of SendKeys
- remove code prior to print which selected a particular slide
- add call to Application.DoEvents() after ExecuteMso()

Also works OK with Select code restored, but after the Print call, and also including a DoEvents() call.

Richard Collins