Toolbar programming

S

Sandy H

I have a custom toolbar that has a print button on it. I want the print
setup dialog to appear when this button is pressed but can't find a way to
make this happen. When customising the toolbar, you can add the print button
and the properties for this are identical to those on the File->Print menu
item. If anyone knows how to get the print setup to appear from a custom
toolbar, I would love to know.

Thanks in advance
Sandy
 
G

Guest

Not sure if there is a better way, but if you use the code

DoCmd.DoMenuItem 1, 0, 10

this will bring up the print setup dialog.
 
A

Albert D.Kallal

If you are talking about a custom menu, and you got the report already
displayed?


For the code that pops up the printer dialog (so the user can change
printers etc).

You can use:

On Error Resume Next
DoCmd.SelectObject acReport, Screen.ActiveReport.Name
DoCmd.RunCommand acCmdPrint

The select object command is needed to fix a "focus" bug if you have a form
with a timer function.

Of course, if you not already viewing a report, then the last line will
still bring up the printer dialog. So, just have your custom menu call the
above code.


The code to print right to the printer while in preview mode, and NOT pop
open the printer dialog can be:

On Error Resume Next
Dim strReportName as string
strREportName = Screen.ActiveReport.Name
DoCmd.SelectObject acReport, strReportName
DoCmd.PrintOut acPrintAll


I used the above for my custom menus for number of years now.....
(again, the above selectobject is not needed unless you got a form with a
timer event)
 

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