Shrini

It is a 20 page document.

object pageRange = "1,3,5,7,9,11,13,15,17,19"

object PrintRangeOfPages = Microsoft.Office.Interop.Word.WdPrintOutRange.wdPrintRangeOfPages;

object PrintDocumentContent = Microsoft.Office.Interop.Word.WdPrintOutItem.wdPrintDocumentContent;

object PrintAllPages = Microsoft.Office.Interop.Word.WdPrintOutPages.wdPrintAllPages;

Document.PrintOut(ref BooleanTrue, ref MissingValue,

ref PrintRangeOfPages, ref MissingValue, ref MissingValue, ref MissingValue,

ref PrintDocumentContent, ref pageRange, ref PrintAllPages, ref BooleanFalse,

ref MissingValue, ref MissingValue, ref BooleanFalse, ref MissingValue,

ref MissingValue, ref MissingValue, ref MissingValue);

Please advise if I am doing something wrong.

shrini



Re: Visual Studio Tools for Office Printing Range of Pages prints in a 20 page document, prints it 20 times

Maarten van Stam

Hi Shrini,

Your question here is not really a VSTO related issue and you are most likely better served in a forum dedicated to the Word object model.

I did however check to see if I could find a solution to your issue and came up with the next document.

http://support.microsoft.com/kb/826218/en-us

If your document to print contained sections it may be required to add section and page definitions in the pages parameter.

The best place to ask questions concerning how to automate an Office application's object model would be the office.developer.automation newsgroup. For a full list, see the "Please Read First" posting at the top of this forum.

Hope it helped,

-= Maarten =-