Print specific range but user to select printer

C

Code Numpty

Hi, I have the following in one of my macros to print to the default printer.

Worksheets("Disinfections").Range("pen_list").PrintOut

How do I change this so that the print dialog box pops up to allow the user
to select the printer and page size?

Happy New Year! (nearly)
 
P

Per Jessen

Hi

This will save Default printer, let user print out on selected printer and
return to default printer.

MyPrinter = ActivePrinter
Application.Dialogs(8).Show ' Show Printer Dialog!
Worksheets("Disinfections").Range("pen_list").PrintOut
Application.ActivePrinter = MyPrinter



Happy New Year!

Per
 
C

Code Numpty

Thanks Per,

What happens now is that I get 2 prints.
The first bit of code
Application.Dialogs(8).Show ' Show Printer Dialog!
prints the area of the sheet containing data or formatting from the print
dialog.
Then the second bit of code
Worksheets("Disinfections").Range("pen_list").PrintOut
prints out the specified range.

The second print is correct because it is a dynamic named range.
How can I get the macro to print the named range through the print dialog box?
 
C

Code Numpty

Thanks Per! Just the job. I've never come across Dialogs(8) or (9) before and
will check them out. You help is much appreciated.

Sharon
 

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