Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MS-Word automation example : From VB to VFP
Message
From
04/02/2004 08:01:34
 
 
To
04/02/2004 07:17:01
Dorin Vasilescu
ALL Trans Romania
Arad, Romania
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00873797
Message ID:
00873819
Views:
12
Hi Dorin, thanks for replying!

I'm automating Word to generate PDF files thru the use of the pdf999 printer driver. Till now I was using:
 oWord.ActivePrinter = "PDF995"
It works ok, but after running my app Word sets the PDF995 "printer" as default.

Searching in MSDN found KB article 216026 (ActivePrinter Property in Word Sets System Default Printer) that reads:

SUMMARY
When you use the ActivePrinter property in Word to set the current printer, you also set the printer you select to be the default printer for the system. If you do not want to change the setting for the default system printer, do not use the ActivePrinter property.

MORE INFORMATION
To select a new printer without having Word change the default system printer, use the WordBasic FilePrintSetup method with the DoNotSetAsSysDefault flag set to True. For example, instead of using the following code: Set oWord =
CreateObject("Word.Application")
   oWord.ActivePrinter = "HP LaserJet 4 on LPT2"
Use the following:
Set oWord = CreateObject("Word.Application")
oWord.WordBasic.FilePrintSetup Printer:="HP LaserJet 4 on LPT2", _
      DoNotSetAsSysDefault:=1
Now I used the syntax you gave me:
oWord.WordBasic.FilePrintSetup("Canon i550 on USB002",1)
Unfortunatelly when running my app now, when Word starts to print the first document (actually it's a batch of many mailmerges) it shows a dialog box for "Document PDF995 Properties" (Layout, Paper/quality etc). I press ok button and all freezes.

Regards,

Fernando

>Hi
>Just tried this and works
>
>
>oWord = CreateObject("Word.Application")
>oWord.Visible = .t.
>oWord.WordBasic.FilePrintSetup("Canon i550 on USB002",1)
>
>
>
>>Hi,
>>
>>I've got instructions to select in what printer MS-Word will execute its next printout in KB #216026 (ActivePrinter Property in Word Sets System Default Printer) as:
>>
>>Set oWord = CreateObject("Word.Application")
>>
>>oWord.WordBasic.FilePrintSetup Printer:="HP LaserJet 4 on LPT2", _
>>      DoNotSetAsSysDefault:=1
>>
>>
>>How should I code in VFP the oWord.WordBasic.FilePrintSetup... statement?
>>
>>Thanks,
>>
>>Fernando
Previous
Reply
Map
View

Click here to load this message in the networking platform