Run-time error '1004': while trying to p_rint out

Status
Not open for further replies.

bamaisgreat

Well-known Member
Joined
Jan 23, 2012
Messages
831
Office Version
  1. 365
Platform
  1. 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>
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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