MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Print user form


Posted by STEVE on March 19, 2001 4:42 PM

Does anyone out there know how ti make a custom user for appear when you go to print your page. I want to creat a custom user form that you you go to print you can select which pages you would like to print. My project can have anywhere from 5 to 10 pages depending on how its set up. I would like to be able to print all the pages or any combonation of the pages. I plan on using check boxes to select the pages the user wants to print. example(pg 2,3 and 6)


Thanks steve


Posted by Dave Hawley on March 19, 2001 5:04 PM

Hi Steve

Place this code in the Workbook module. It will show your User Form before any printing takes place.


Private Sub Workbook_BeforePrint(Cancel As Boolean)
UserForm1.Show
End Sub

Dave


OzGrid Business Applications

Posted by steve on March 19, 2001 5:18 PM

Dave,

is it posible to have check boxes enable different print areas or pages or to print all of the pages with another check box.

Thanks steve

Posted by Dave Hawley on March 19, 2001 5:40 PM

Steve, anything is possible with VBA :o)

Try these 2 procedues. I have not tested them though as I have no printer at the moment. You MAY need to comment out the Application.SceenUpdating=false


Private Sub CheckBox1_Click()
With Sheets("Sheet1")
.Activate
.Range("A1:C15").PrintOut
End With
End Sub

Private Sub CheckBox2_Click()
Dim Sht As Worksheet
Application.ScreenUpdating = True
For Each Sht In ThisWorkbook.Worksheets
Sht.Select
Sht.Range("A1:C15").PrintOut
Next Sht
Application.ScreenUpdating = True
End Sub

Dave

OzGrid Business Applications

Posted by steve on March 19, 2001 6:51 PM

Thanks for the code dave, I think I can modify it to work for me