Print Box

J

Jordon

Can someone please help. I need to create a box that pops up after pressing a button in Excel that gives the user check boxes to choose which areas to print. Eg. I choose check box 1...it previews area 1, I choose check box 2...it previews area 2. I admit I am not sure where to start, so if someone out there has a complete sample for displaying a print area choose box and displays that print choice
Thanks for the help
 
R

Ron de Bruin

Hi Jordon

Read this first
http://support.microsoft.com/default.aspx?scid=kb;EN-US;829070

If you use a userform and add option buttons on it you can
use this code in the userform module to do what you want.

Private Sub OptionButton1_Click()
Unload Me
Range("A1:A10").PrintPreview
End Sub

Private Sub OptionButton2_Click()
Unload Me
Range("B1:b10").PrintPreview
End Sub

Private Sub OptionButton3_Click()
Unload Me
Range("C1:C10").PrintPreview
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


Jordon said:
Can someone please help. I need to create a box that pops up after pressing a button in Excel that gives the user check boxes to
choose which areas to print. Eg. I choose check box 1...it previews area 1, I choose check box 2...it previews area 2. I admit I
am not sure where to start, so if someone out there has a complete sample for displaying a print area choose box and displays that
print choice.
 
J

Jordon

Perfect! Thanks...this is very helpful

----- Ron de Bruin wrote: ----

Hi Jordo

Read this firs
http://support.microsoft.com/default.aspx?scid=kb;EN-US;82907

If you use a userform and add option buttons on it you ca
use this code in the userform module to do what you want

Private Sub OptionButton1_Click(
Unload M
Range("A1:A10").PrintPrevie
End Su

Private Sub OptionButton2_Click(
Unload M
Range("B1:b10").PrintPrevie
End Su

Private Sub OptionButton3_Click(
Unload M
Range("C1:C10").PrintPrevie
End Su


--
Regards Ron de Brui
http://www.rondebruin.n


Jordon said:
Can someone please help. I need to create a box that pops up after pressing a button in Excel that gives the user check boxes t
choose which areas to print. Eg. I choose check box 1...it previews area 1, I choose check box 2...it previews area 2. I admit
am not sure where to start, so if someone out there has a complete sample for displaying a print area choose box and displays tha
print choice
 
J

Jordon

Thanks Ron! One more curve....How can I add check boxes and allow user to select more than one check box which in turn previews multiple print areas? In other words the user checks box 1 and box 2...hits the "OK" button and it previews both of those print areas
Thanks in advance
 
R

Ron de Bruin

Hi Jordon

Add three checkboxes on your userform and one button.
Try this code for the button

Private Sub CommandButton1_Click()
Dim Num As Integer
Num = Abs(CheckBox1.Value) * 1 + _
Abs(CheckBox2.Value) * 3 + _
Abs(CheckBox3.Value) * 5

Select Case Num
Case 1
MsgBox "Run the code for checkbox 1"
Case 3
MsgBox "Run the code for checkbox 2"
Case 5
MsgBox "Run the code for checkbox 3"
Case 4
MsgBox "Run the code for checkbox 1 + 2"
Case 9
MsgBox "Run the code for checkbox 1 + 2 + 3"
Case 6
MsgBox "Run the code for checkbox 1 + 3"
Case 8
MsgBox "Run the code for checkbox 2 + 3"
End Select
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


Jordon said:
Thanks Ron! One more curve....How can I add check boxes and allow user to select more than one check box which in turn previews
multiple print areas? In other words the user checks box 1 and box 2...hits the "OK" button and it previews both of those print
areas.
 
J

Jordon

Thanks again Ron! Great help! Sorry to keep on, but when I add the print preview code after say the first check box...it works, previews, but the userform stay on top and does not let me get out of it. Is there a way to close the userform after confirming selection? Thanks again in advance

----- Ron de Bruin wrote: ----

Hi Jordo

Add three checkboxes on your userform and one button
Try this code for the butto

Private Sub CommandButton1_Click(
Dim Num As Intege
Num = Abs(CheckBox1.Value) * 1 +
Abs(CheckBox2.Value) * 3 +
Abs(CheckBox3.Value) *

Select Case Nu
Case
MsgBox "Run the code for checkbox 1
Case
MsgBox "Run the code for checkbox 2
Case
MsgBox "Run the code for checkbox 3
Case
MsgBox "Run the code for checkbox 1 + 2
Case
MsgBox "Run the code for checkbox 1 + 2 + 3
Case
MsgBox "Run the code for checkbox 1 + 3
Case
MsgBox "Run the code for checkbox 2 + 3
End Selec
End Su


--
Regards Ron de Brui
http://www.rondebruin.n


Jordon said:
Thanks Ron! One more curve....How can I add check boxes and allow user to select more than one check box which in turn preview
multiple print areas? In other words the user checks box 1 and box 2...hits the "OK" button and it previews both of those prin
areas
 
R

Ron de Bruin

Hi Jordon

You must Unload the Userform first

like this

Case 1
Unload Me
Range("A1:A10").PrintPreview
Case 3
Unload Me
Range("B1:B10").PrintPreview
Case 5
Unload Me
Range("C1:C10").PrintPreview
Case 4
Unload Me
Range("A1:A10").PrintPreview
Range("B1:B10").PrintPreview


--
Regards Ron de Bruin
http://www.rondebruin.nl


Jordon said:
Thanks again Ron! Great help! Sorry to keep on, but when I add the print preview code after say the first check box...it works,
previews, but the userform stay on top and does not let me get out of it. Is there a way to close the userform after confirming
selection? Thanks again in advance.
 
J

Jordon

Hi Ron,
Sorry again...this works, however..I need to have each checkbox choice show up together on the print preview instead of having to "close" the print preview to go to the next print area. In other words, the user selects box 1 & 2...the preview window has the option of clicking on "next" to go to the next choice. Can you help me write the code for this?
Thanks
 
R

Ron de Bruin

Hi Jordon
No problem

Use this
Range("A1:A10,B1:B10").PrintPreview
or
Range("A1:A10,B1:B10,C1:C10").PrintPreview




--
Regards Ron de Bruin
http://www.rondebruin.nl


Jordon said:
Hi Ron,
Sorry again...this works, however..I need to have each checkbox choice show up together on the print preview instead of having
to "close" the print preview to go to the next print area. In other words, the user selects box 1 & 2...the preview window has the
option of clicking on "next" to go to the next choice. Can you help me write the code for this?
 
J

Jordon

Thanks! Below is the code I am using. It works when I select one check box...however when I choose 2 check boxes the "ok" button does not do anything...can you assist? Basically what I would like to do is enable the user to select 2 boxes and have those print areas show up as two pages in the print preview screen. The areas to print are on different pages.
Thanks
 
R

Ron de Bruin

I don't see your code

--
Regards Ron de Bruin
http://www.rondebruin.nl


Jordon said:
Thanks! Below is the code I am using. It works when I select one check box...however when I choose 2 check boxes the "ok" button
does not do anything...can you assist? Basically what I would like to do is enable the user to select 2 boxes and have those print
areas show up as two pages in the print preview screen. The areas to print are on different pages.
 
J

Jordon

I think I just figured it out! Thanks so much for the help...I think I am done now!
Thanks again.
 
Top