I've got a dialog box with check boxes on it each relating to a sheet. I want the user to be able to select which pages they want to print then there selection be printed. I have done the following code to make the string of pages to use in the print code but I cant get the ," " to add to each page name so that the Array() will take the variable.
Also I'm having problems with a runtime error 1004 - Method Printout of object Sheets failed ????? Is this because the dialog box is still open and if so how do I solve this.
Thanks.
Sub PrintSelection2()
Dim PrintArray As String
Dim strTemp As String
DialogSheets("Print Menu".Select
If [Check box 6] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "Cover"
End If
If [Check box 7] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "Contents"
End If
If [Check box 8] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ","
End If
strTemp = strTemp & "Summary"
End If
If [Check box 9] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "KPI's - Telephone"
End If
If [Check box 10] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "KPI's - Internet"
End If
If [Check box 11] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "Graphs"
End If
If [Check box 12] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "Margin Analysis - Summary"
End If
If [Check box 13] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "Event Analysis"
End If
PrintArray = strTemp
Sheets(Array(PrintArray)).Select
Sheets("Summary".Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, collate:=True
End Sub
Also I'm having problems with a runtime error 1004 - Method Printout of object Sheets failed ????? Is this because the dialog box is still open and if so how do I solve this.
Thanks.
Sub PrintSelection2()
Dim PrintArray As String
Dim strTemp As String
DialogSheets("Print Menu".Select
If [Check box 6] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "Cover"
End If
If [Check box 7] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "Contents"
End If
If [Check box 8] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ","
End If
strTemp = strTemp & "Summary"
End If
If [Check box 9] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "KPI's - Telephone"
End If
If [Check box 10] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "KPI's - Internet"
End If
If [Check box 11] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "Graphs"
End If
If [Check box 12] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "Margin Analysis - Summary"
End If
If [Check box 13] = 1 Then
If (Len(strTemp) > 0) Then
strTemp = strTemp & ", "
End If
strTemp = strTemp & "Event Analysis"
End If
PrintArray = strTemp
Sheets(Array(PrintArray)).Select
Sheets("Summary".Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, collate:=True
End Sub