View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected][_2_] mattkahne@yahoo.com[_2_] is offline
external usenet poster
 
Posts: 3
Default Print dialog - force it to show up?

Hi there,

I have a feeling the answer to this is going to be "not possible", but
I figured it couldn't hurt to ask.

I have a multi-page Excel workbook. Each spreadsheet in the workbook
has a print CommandButton I've put at the bottom, plus of course the
print and print preview buttons on the Excel toolbar.

Recently I had to add an item to each sheet where some text in the
footer is created on the fly at printout, but only on the first page if
the printout of the worksheet is multiple pages. To accomplish that I
put code behind the print CommandButtons, and in the
Workbook_BeforePrint sub in ThisWorkbook, so it fires for both my print
button and the Excel toolbar buttons.

To avoid having spreadsheets print twice the code in
Workbook_BeforePrint includes a "Cancel=True" at the end, and looks
like this:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Application.EnableEvents = False
[Set up LeftFooter]
ActiveWindow.SelectedSheets.Printout From:=1, To:=1, Copies:=1
[Clear LeftFooter]
ActiveWindow.SelectedSheets.Printout From:=2, Copies:=1
Application.EnableEvents = True
Cancel = True
End Sub

However, one thing I neglected to think of is that with this code in
place, if the user selects File-Print, the spreadsheet just prints as
though the user had clicked the Excel toolbar print button, the print
dialog box does not come up.

It's not a critical thing as there are only a couple of the 50+ users
who regularly use the print dialog to change printers, but if there's a
way to actually bring up the print dialog when the user does a
File-Print that would be great.

Any thoughts?

Thanks!

Matt