Print dialog return help needed

B

BrianG

I'm using the following code to handle printing and setting a flag to
confirm printing...

Application.Dialogs(xlDialogPrint).Show 2, 1, 3, PrintQty, , , , ,
, , , , , , True
strPrinted = "Y" 'Set Printed flag to "Y"

I need to capture the return code so as not to set the flag if the
print is cancelled. I tried

dlgAnswer = Application.Dialogs(xlDialogPrint).Show 2, 1, 3,
PrintQty, , , , , , , , , , , True

but the result is a Compile error (expected end of statement after
"Show").

Can anyone offer any suggestions on how to capture a cancel of the
print dialog and still set the default print of 2 copies, collated?
 
J

Jim Cone

The variable dlgAnswer needs to be a Variant and parenthesis are needed
around arguments when you are returning a value...

dlgAnswer = Application.Dialogs(xlDialogPrint).Show(2, 1, 3, _
PrintQty, , , , , , , , , , , True)
If dlgAnswer = False Then
Exit Sub
Else
strPrinted = "Y"
End If
--------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"BrianG" <[email protected]>
wrote in message
I'm using the following code to handle printing and setting a flag to
confirm printing...

Application.Dialogs(xlDialogPrint).Show 2, 1, 3, PrintQty, , , , ,
, , , , , , True
strPrinted = "Y" 'Set Printed flag to "Y"

I need to capture the return code so as not to set the flag if the
print is cancelled. I tried

dlgAnswer = Application.Dialogs(xlDialogPrint).Show 2, 1, 3,
PrintQty, , , , , , , , , , , True

but the result is a Compile error (expected end of statement after
"Show").
Can anyone offer any suggestions on how to capture a cancel of the
print dialog and still set the default print of 2 copies, collated?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top