bamaisgreat
Well-known Member
- Joined
- Jan 23, 2012
- Messages
- 831
- Office Version
- 365
- Platform
- Windows
Run-time error '1004': while trying to print
I have created a user form were I select certain checkboxes for the sheets I want to print and then run the code below to print.
If possible could someone take a look and see what I need to correct to fix this problem? Thanks for the help as always
Here is the code I have
Code:
<code class="bbcode_code" style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px; direction: ltr; font-size: 12px;">Private Sub CommandButton1_Click()
If Me.CheckBox1 = True Then
ThisWorkbook.Sheets("SHT#1").PrintOut Copies = 1
End If
If Me.CheckBox2 = True Then
ThisWorkbook.Sheets("SHT#2").PrintOut Copies = 1
End If
If Me.CheckBox3 = True Then
ThisWorkbook.Sheets("SHT#3").PrintOut Copies = 1
End If
If Me.CheckBox4 = True Then
ThisWorkbook.Sheets("SHT#4").PrintOut Copies = 1
End If
If Me.CheckBox5 = True Then
ThisWorkbook.Sheets("SHT#5").PrintOut Copies = 1
End If
If Me.CheckBox6 = True Then
ThisWorkbook.Sheets("SHT#6").PrintOut Copies = 1
End If
If Me.CheckBox7 = True Then
ThisWorkbook.Sheets("SHT#7").PrintOut Copies = 1
End If
If Me.CheckBox8 = True Then
ThisWorkbook.Sheets("SHT#8").PrintOut Copies = 1
End If
If Me.CheckBox9 = True Then
ThisWorkbook.Sheets("SHT#9").PrintOut Copies = 1
End If
If Me.CheckBox10 = True Then
ThisWorkbook.Sheets("SHT#10").PrintOut Copies = 1
End If
If Me.CheckBox11 = True Then
ThisWorkbook.Sheets("SHT#11").PrintOut Copies = 1
End If
If Me.CheckBox12 = True Then
ThisWorkbook.Sheets("SHT#12").PrintOut Copies = 1
End If
If Me.CheckBox13 = True Then
ThisWorkbook.Sheets("SHT#13").PrintOut Copies = 1
End If
If Me.CheckBox14 = True Then
ThisWorkbook.Sheets("SHT#14").PrintOut Copies = 1
End If
If Me.CheckBox15 = True Then
ThisWorkbook.Sheets("SHT#15").PrintOut Copies = 1
End If
If Me.CheckBox16 = True Then
ThisWorkbook.Sheets("SHT#16").PrintOut Copies = 1
End If
If Me.CheckBox17 = True Then
ThisWorkbook.Sheets("SHT#17").PrintOut Copies = 1
End If
If Me.CheckBox18 = True Then
ThisWorkbook.Sheets("SHT#18").PrintOut Copies = 1
End If
If Me.CheckBox19 = True Then
ThisWorkbook.Sheets("SHT#19").PrintOut Copies = 1
End If
If Me.CheckBox20 = True Then
ThisWorkbook.Sheets("SHT#20").PrintOut Copies = 1
End If
If Me.CheckBox21 = True Then
ThisWorkbook.Sheets("SHT#21").PrintOut Copies = 1
End If
If Me.CheckBox22 = True Then
ThisWorkbook.Sheets("SHT#22").PrintOut Copies = 1
End If
If Me.CheckBox23 = True Then
ThisWorkbook.Sheets("SHT#23").PrintOut Copies = 1
End If
If Me.CheckBox24 = True Then
ThisWorkbook.Sheets("SHT#24").PrintOut Copies = 1
End If
If Me.CheckBox25 = True Then
ThisWorkbook.Sheets("SHT#25").PrintOut Copies = 1
End If
If Me.CheckBox26 = True Then
ThisWorkbook.Sheets("SHT#26").PrintOut Copies = 1
End If
End Sub</code>
If possible could someone take a look and see what I need to correct to fix this problem? Thanks for the help as always
Here is the code I have
Code:
<code class="bbcode_code" style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px; direction: ltr; font-size: 12px;">Private Sub CommandButton1_Click()
If Me.CheckBox1 = True Then
ThisWorkbook.Sheets("SHT#1").PrintOut Copies = 1
End If
If Me.CheckBox2 = True Then
ThisWorkbook.Sheets("SHT#2").PrintOut Copies = 1
End If
If Me.CheckBox3 = True Then
ThisWorkbook.Sheets("SHT#3").PrintOut Copies = 1
End If
If Me.CheckBox4 = True Then
ThisWorkbook.Sheets("SHT#4").PrintOut Copies = 1
End If
If Me.CheckBox5 = True Then
ThisWorkbook.Sheets("SHT#5").PrintOut Copies = 1
End If
If Me.CheckBox6 = True Then
ThisWorkbook.Sheets("SHT#6").PrintOut Copies = 1
End If
If Me.CheckBox7 = True Then
ThisWorkbook.Sheets("SHT#7").PrintOut Copies = 1
End If
If Me.CheckBox8 = True Then
ThisWorkbook.Sheets("SHT#8").PrintOut Copies = 1
End If
If Me.CheckBox9 = True Then
ThisWorkbook.Sheets("SHT#9").PrintOut Copies = 1
End If
If Me.CheckBox10 = True Then
ThisWorkbook.Sheets("SHT#10").PrintOut Copies = 1
End If
If Me.CheckBox11 = True Then
ThisWorkbook.Sheets("SHT#11").PrintOut Copies = 1
End If
If Me.CheckBox12 = True Then
ThisWorkbook.Sheets("SHT#12").PrintOut Copies = 1
End If
If Me.CheckBox13 = True Then
ThisWorkbook.Sheets("SHT#13").PrintOut Copies = 1
End If
If Me.CheckBox14 = True Then
ThisWorkbook.Sheets("SHT#14").PrintOut Copies = 1
End If
If Me.CheckBox15 = True Then
ThisWorkbook.Sheets("SHT#15").PrintOut Copies = 1
End If
If Me.CheckBox16 = True Then
ThisWorkbook.Sheets("SHT#16").PrintOut Copies = 1
End If
If Me.CheckBox17 = True Then
ThisWorkbook.Sheets("SHT#17").PrintOut Copies = 1
End If
If Me.CheckBox18 = True Then
ThisWorkbook.Sheets("SHT#18").PrintOut Copies = 1
End If
If Me.CheckBox19 = True Then
ThisWorkbook.Sheets("SHT#19").PrintOut Copies = 1
End If
If Me.CheckBox20 = True Then
ThisWorkbook.Sheets("SHT#20").PrintOut Copies = 1
End If
If Me.CheckBox21 = True Then
ThisWorkbook.Sheets("SHT#21").PrintOut Copies = 1
End If
If Me.CheckBox22 = True Then
ThisWorkbook.Sheets("SHT#22").PrintOut Copies = 1
End If
If Me.CheckBox23 = True Then
ThisWorkbook.Sheets("SHT#23").PrintOut Copies = 1
End If
If Me.CheckBox24 = True Then
ThisWorkbook.Sheets("SHT#24").PrintOut Copies = 1
End If
If Me.CheckBox25 = True Then
ThisWorkbook.Sheets("SHT#25").PrintOut Copies = 1
End If
If Me.CheckBox26 = True Then
ThisWorkbook.Sheets("SHT#26").PrintOut Copies = 1
End If
End Sub</code>