Print Dialog Box pre-select choices

briannakmg

New Member
Joined
Jan 26, 2006
Messages
42
I am looking to have the print dialog box pop up for the users of my spreadsheet and I need the "selection" radio button under "Print What" to be selected instead of "Active Sheet(s)". I've already got everything selected I just don't think the users will remember to choose "selection" when they print.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
This should work :

Place this in a standard module in your project :

Code:
Public Declare Function SetTimer _
Lib "user32" _
    (ByVal hwnd As Long, _
    ByVal nIDEvent As Long, _
    ByVal uElapse As Long, _
    ByVal lpTimerFunc As Long) As Long
 
Public Declare Function KillTimer _
Lib "user32" _
    (ByVal hwnd As Long, _
    ByVal nIDEvent As Long) As Long
    
Public lTimerID As Long
 
Public Sub TimerProc()
 
    KillTimer 0, lTimerID
    SendKeys "%n", True
 
End Sub


Place this in the workbook module :

Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
 
    lTimerID = SetTimer(0, 0, 1, AddressOf TimerProc)
 
End Sub

Regards.
 
Upvote 0
You can also use:
Code:
application.Dialogs(xlDialogPrint).Show ,,,,,,,,,,,1
 
Upvote 0
You can also use:
Code:
application.Dialogs(xlDialogPrint).Show ,,,,,,,,,,,1

Rory,

The arguments of dialogs are not documented on help files . How/where did you find out about them ?

Thanks ahead.
 
Upvote 0
Jaafar,
They are basically the same arguments you would use with the old XLM macro functions, so if you get hold of the Macrofun.hlp help file, you can usually figure out the arguments for most dialogs - they're in the same order, thankfully!
Edit: you can hopefully still get the file here.
 
Last edited:
Upvote 0
Jaafar,
They are basically the same arguments you would use with the old XLM macro functions, so if you get hold of the Macrofun.hlp help file, you can usually figure out the arguments for most dialogs - they're in the same order, thankfully!
Edit: you can hopefully still get the file here.

:) Installed the help files - great info . Will be exploring those XLM macros.


PRINT(range_num, from, to, copies, draft, preview, print_what, color, feed, quality, y_resolution, selection)

Many thanks.
 
Upvote 0
I knew it was something simple, just couldn't find anything in the help menus on how many commas I would need!

Thanks so much,
Brianna
 
Upvote 0

Forum statistics

Threads
1,214,551
Messages
6,120,156
Members
448,948
Latest member
spamiki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top