Well I am able to print using the print out function but when I try to pass parameters like which pages to print etc, I am not able to do that.

myDoc.PrintOut(covFalse, // Background.
covOptional, // Append.
&vName,//covOptional, // Range.
covOptional, // OutputFileName.
covOptional, // // From.
covOptional, // // To.
covOptional, // Item.
COleVariant((long)1), // Copies.
covOptional, // Pages.
covOptional, // PageType.
covOptional, // PrintToFile.
covOptional, // Collate.
covOptional, // ActivePrinterMacGX.
covOptional, // ManualDuplexPrint.
covOptional, // PrintZoomColumn New with Word 2002
covOptional, // PrintZoomRow ditto
covOptional, // PrintZoomPaperWidth ditto
covOptional)

So this code works perfectly and print the doc, but what I want to od is print only a number thats entered by the user like pages 2 to 8 or or like 2,4-5 , now from help it seems its possible to do that but all samples are in vb and I dont know know how to do all that in c++, as have tried all combinations and it wonr work, and starts to fail altogethere.

I have tried like
VARIANT vName;
vName.vt = VT_BSTR;
vName.bstrVal = SysAllocString(L"WdPrintOutRange.wdPrintFromTo");
myDoc.PrintOut(covFalse, // Background.
covOptional, // Append.
&vName,//covOptional, // Range.
covOptional, // OutputFileName.
COleVariant((long)1), //covOptional, // // From.
COleVariant((long)2), //covOptional, // // To.
covOptional, // Item.
COleVariant((long)1), // Copies.
covOptional, // Pages.
covOptional, // PageType.
covOptional, // PrintToFile.
covOptional, // Collate.
covOptional, // ActivePrinterMacGX.
covOptional, // ManualDuplexPrint.
covOptional, // PrintZoomColumn New with Word 2002
covOptional, // PrintZoomRow ditto
covOptional, // PrintZoomPaperWidth ditto
covOptional)

it fails, and nothing is printed even.

I also have to pass options like the paper size(letter size or a4, but how can I do that).

Please help!

Pauli