>Agnes,
>
>I'm not exactly sure what you're asking here. If you wish to programmatically change the default printer, I'd use the WScript.Network object's SetDefaultPrinter() method (yes, it work with local printers as well). Ed Rauh and I documented how to do this in the December, 2000 issue of the VFUG newsletter in the fourth of our five articles on the Windows Script Host. It's available on-line at
www.vfug.org.
>
>The Common Dialog Control's ShowPrinter() method may or may not change the default printer, depending on the value assigned to the PrinterDefault property.
George,
let's try in other words.
1. My customer will not allow install of scripting host. (I myself avoid this as well)
2. I will change only the printer for next REPORT FORM.
3. I can not use the easy REPORT ... TO PRINTER PROMPT, because I need total pages in front of preview.
If I change printer after counting with REPORT FORM xxxx TO PRINTER
PROMPT it may change the total number of pages.
4 I've use sys(1037) in the moment, but this is not what I like because is doesn't give any information about 'Cancel'.
I add CommonDlg to a form, nothing is changed on it.
My code looks like:
...
THISFORM.oleCommonDialog.Flags = 0x100000+0x8+0x4
THISFORM.oleCommonDialog.ShowPrinter()
IF THISFORM.gnFormError=1 THEN
RETURN
ENDIF
pcPageCount = ''
REPORT FORM xxxx NOCONSOLE TO FILE (lcTempFile)
pcPageCount = TRANSFORM(_PAGENO)
REPORT FORM xxxx to printer preview
...
The REPORT is printed to the printer I select on ShowPrinter and windows default printer is changed
if I change to
...
THISFORM.oleCommonDialog.Flags = 0x100000+0x8+0x4
THISFORM.oleCommonDialog.PrinterDefault = .F.
THISFORM.oleCommonDialog.ShowPrinter()
IF THISFORM.gnFormError=1 THEN
RETURN
ENDIF
pcPageCount = ''
REPORT FORM xxxx NOCONSOLE TO FILE (lcTempFile)
pcPageCount = TRANSFORM(_PAGENO)
REPORT FORM xxxx to printer preview
...
the printer for REPORT FORM is not changed. ShowPrinter works in this case like a OK/Cancel messagebox with some controls to play with.
I hope this describes my problem better.
Maybe I run completely in the wrong direction, but what I finaly need is a report with totalpages, printer selectable, wich stops reporting if I press 'cancel' on print dialog.
A far dream is to select a range of pages from preview, but as I see the problem I cannot do this.
Any ideas to do this are welcome
Agnes
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]