MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Printpreview help


Posted by steve w on June 12, 2001 8:52 AM

Can someone help, I use the following code in a print userform. What I need is to be able to printpreview, but it only freezes up when I try to do it the same way I print. I use the before print command in the workbook and I cancel the original print job.
Does anyone have any ideas.

thanks for any input you can provide
steve w

(Example of printout method)

If CheckBox6.Value = True Then
Sheet4.Range("EE1:FA35").PrintOut
End If


Heres the code

Private Sub CommandButton1_Click()
Dim i As Integer
For i = 1 To Val(TextBox2.Text)
'BUILDER PAGE
If CheckBox7.Value = True Then
'1ST PAGE
If OptionButton1.Value = True Then


'If CheckBox1.Value = True Then
'Sheet3.Range("A1:Y35,AQ1:BN35,BV1:CY35,DD1:EA35,EE1:FA35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True

'End If

If CheckBox2.Value = True Then
Sheet3.Range("A1:Y35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox3.Value = True Then
Sheet3.Range("AQ1:BN35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox4.Value = True Then
Sheet3.Range("BV1:CY35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox5.Value = True Then
Sheet3.Range("DD1:EA35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox6.Value = True Then
Sheet3.Range("EE1:FA35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
End If
'2ND Page
If OptionButton2.Value = True Then

If CheckBox2.Value = True Then
Sheet3.Range("A36:Y70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox3.Value = True Then
Sheet3.Range("AQ36:BN70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox4.Value = True Then
Sheet3.Range("BV36:CY70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox5.Value = True Then
Sheet3.Range("DD36:EA70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox6.Value = True Then
Sheet3.Range("EE36:FA70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
End If
If OptionButton3.Value = True Then
'If CheckBox1.Value = True Then
'Sheet3.Range("A1:Y35,A36:Y70,AQ1:BN35AQ36:BN70,BV1:CY35,BV36:CY70,DD1:EA35,DD36:EA70,EE1:FA35,EE36:FA70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True

'End If

If CheckBox2.Value = True Then
Sheet3.Range("A1:Y35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
Sheet3.Range("A36:Y70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox3.Value = True Then
Sheet3.Range("AQ1:BN35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
Sheet3.Range("AQ36:BN70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox4.Value = True Then
Sheet3.Range("BV1:CY35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
Sheet3.Range("BV36:CY70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox5.Value = True Then
Sheet3.Range("DD1:EA35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
Sheet3.Range("DD36:EA70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox6.Value = True Then
Sheet3.Range("EE1:FA35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
Sheet3.Range("EE36:FA70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
End If
End If
'DESIGN PAGE
If CheckBox8.Value = True Then
If OptionButton1.Value = True Then
'If CheckBox1.Value = True Then
'Sheet4.Range("A1:Y35,AQ1:BN35,BV1:CY35,DD1:EA35,EE1:FA35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
'End If

If CheckBox2.Value = True Then
Sheet4.Range("A1:Y35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox3.Value = True Then
Sheet4.Range("AQ1:BN35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox4.Value = True Then
Sheet4.Range("BV1:CY35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox5.Value = True Then
Sheet4.Range("DD1:EA35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox6.Value = True Then
Sheet4.Range("EE1:FA35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
End If
'2ND Page
If OptionButton2.Value = True Then
'If CheckBox1.Value = True Then
'Sheet4.Range("A36:Y70,AQ36:BN70,BV36:CY70,DD36:EA70,EE36:FA70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
'End If

If CheckBox2.Value = True Then
Sheet4.Range("A36:Y70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox3.Value = True Then
Sheet4.Range("AQ36:BN70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox4.Value = True Then
Sheet4.Range("BV36:CY70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox5.Value = True Then
Sheet4.Range("DD36:EA70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox6.Value = True Then
Sheet4.Range("EE36:FA70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
End If
If OptionButton3.Value = True Then
'If CheckBox1.Value = True Then
'Sheet4.Range("A1:Y35,A36:Y70,AQ1:BN35AQ36:BN70,BV1:CY35,BV36:CY70,DD1:EA35,DD36:EA70,EE1:FA35,EE36:FA70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True

'End If

If CheckBox2.Value = True Then
Sheet4.Range("A1:Y35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
Sheet4.Range("A36:Y70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox3.Value = True Then
Sheet4.Range("AQ1:BN35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
Sheet4.Range("AQ36:BN70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox4.Value = True Then
Sheet4.Range("BV1:CY35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
Sheet4.Range("BV36:CY70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox5.Value = True Then
Sheet4.Range("DD1:EA35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
Sheet4.Range("DD36:EA70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
If CheckBox6.Value = True Then
Sheet4.Range("EE1:FA35").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
Sheet4.Range("EE36:FA70").PrintOut 'Copies:=Val(TextBox2.Text), Collate:=True
End If
End If
End If
Next i
Unload Me


End Sub


Posted by Joe Was on June 12, 2001 10:27 AM

Try setting "Preview:=True" in the form of this syntax and substitute your qualifier for the one before "PrintOut" in the example below? JSW

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True, Collate:=True