Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Toolbar & Print 2

Status
Not open for further replies.

orna

Programmer
Apr 2, 2002
314
IL
Hi
I created a custom toolbar.
One of the options is 'Print' but I need it to bring the Print Window to choose printer, Print range....
and instead it prints to the default printer.
How do I do it?

Thanks
 
How are ya orna . . .

Sounds like you instantiated the [blue]system print button[/blue].

[ol][li]In a [blue]module[/blue] in the [blue]modules window[/blue], copy/paste the following function:
Code:
[blue]Public Function OpenPrintDialog()

On Error GoTo GotErr
   DoCmd.RunCommand acCmdPrint
GotErr:

End Function[/blue]
[/li]
[li]In the [blue]Action[/blue] property of your [blue]Print[/blue] button, copy/paste the following:
Code:
[blue]=OpenPrintDialog()[/blue]
[/li]
[li]Finally in any [blue]VBE[/blue] window: [green]MenuBar - Tools - Options - General Tab[/green]. In the [green]Error trapping section[/green] select the option [purple]Break on Unhandled Errors[/purple] and click OK.[/li]
[li]Try the button! [thumbsup2][/li][/ol]
[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Hi Orna (and TheAceman1),
Well this is something I came accross before. Although printbuttons in toolbars look the same, they do different things. I you want the print dialog first (where you can choose a printer and a range), choose the printer from the real menu bar, not from the customize toolbar dialog.

In steps:
Choose customize (right click menu bar), go to the menu bar, then file, now drag the printer icon to your toolbar or whatever and your done. Clicking on this one icon the print dialog appears instead of printing right a way to the default printer.... Can you follow?

PS: To get the original printer icon back in the menu again, reset the menu...

Pampers [afro]
Keeping it simple can be complicated
 
Thanks TheAceMan1 and pampers!
Nice to learn new things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top