I'm showing the wdDialogFilePrint, but I would like to force
wdPrintDocumentWithMarkup. I tried something like:
Set didPrint = Dialogs(wdDialogFilePrint)
didPrint.Display
didPrint.Item = wdPrintDocumentWithMarkup
didPrint.Execute
but that doesn't work. :/
All the help I've seen suggests that I can only use
wdPrintDocumentWithMarkup with PrintOut. If true, will PrintOut use
the settings I've captured in the didPrint Dialog object?
If you need to use wdPrintDocumentWithMarkup, you're stuck with using
the PrintOut method. The reason is a little complicated, and more than
a little stupid...
The parameters of the built-in dialogs in Word 97 and later are all
identical to the ones used in WordBasic in Word 95 and earlier. The
parameter of the wdDialogFilePrint dialog object that corresponds to
the Print What box in the dialog is named "Type". You can find this in
the FilePrint topic of the WordBasic help file, which is still
available for download from
http://www.microsoft.com/downloads/...FamilyID=1A24B2A7-31AE-4B7C-A377-45A8E2C70AB2.
The trouble with this is that in VBA, the Dialog object itself has a
Type property. The value of Dialogs(wdDialogFilePrint).Type is 88,
which is the value of the constant wdDialogFilePrint -- in other
words, it returns the answer to "what type of dialog is this?" This is
a read-only property, so code that _should_ work
Dim dlg As Dialog
Set dlg = Dialogs(wdDialogFilePrint)
With dlg
.Type = wdPrintDocumentWithMarkup
.Execute
End With
fails with a compile error "Can't assign to a read-only property".
What you can do instead is to use the .Display method of the dialog to
let the user set the desired controls, and then transfer the resulting
parameters to the PrintOut method, and add the
Item:=wdPrintDocumentWithMarkup parameter as you do that:
Dim dlg As Dialog
Set dlg = Dialogs(wdDialogFilePrint)
With dlg
If .Display = -1 Then
ActiveDocument.PrintOut _
Background:=True, _
Range:=.Range, _
from:=.from, to:=.to, _
Item:=wdPrintDocumentWithMarkup, _
Copies:=.numcopies, _
Pages:=.Pages
End If
End With
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.