Tony
Wed Mar 21 13:13:03 CDT 2007
LOL!
Not you, Jay, of course not you! It's those pesky users - I think they do it
on purpose <g>
--
Enjoy,
Tony
"Jay Freedman" <jay.freedman@verizon.net> schreef in bericht
news:%23NHuEt9aHHA.1300@TK2MSFTNGP02.phx.gbl...
>> So the method will work properly only if the user never makes a
>> mistake :)
>
> A mistake? Moi? Never! ;-)
>
> Tony Jollans wrote:
>>> 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
>>>
>>
>> Unfortunately this is not a perfect solution as error handling does
>> not work properly with the Display method. I have just checked and
>> this is still the case in Word 2007.
>>
>> For example, if a user enters "abc" in the Pages box, the dialog
>> recognises the error and redisplays but without any error message. If
>> the user manages to correct the error the dialog will then show the
>> error message it should have shown earlier and return the error,
>> rather than the correction, to the VBA code.
>>
>> So the method will work properly only if the user never makes a
>> mistake :)
>>
>> "Jay Freedman" <jay.freedman@verizon.net> schreef in bericht
>> news:il8103l1q9uv1002065b28dphaikr4uk92@4ax.com...
>>> On 20 Mar 2007 14:02:42 -0700, cklester@gmail.com wrote:
>>>
>>>> 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/details.aspx?displaylang=en&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 FAQ:
http://word.mvps.org
>>> Email cannot be acknowledged; please post all follow-ups to the
>>> newsgroup so all may benefit.
>
>