I'm using userforms as a method to input data and create forms. So far I have Hidden Excel and opened the main Userform on open. I have a total of 5 userforms that all create different forms that I need available for print. On one of the userforms I have a command button to print preview the appropriate worksheets. I need help with the code to show the sheets, execute the preview/print, hide the sheets. All of this without ever displaying the workbook to the user if possible. my current Print preview command is
Private Sub cmdprintpreview_Click()
'unhide sheets for preview without exposing them
'Print Preview for all selected forms
Me.Hide
If Me.chk7120 = True And Me.chk71201 = True And Me.chk71203 = True And Me.chk71202 = True Then
Sheets(Array("7120R", "71201R", "71202R", "71203R")).PrintPreview
ElseIf Me.chk7120 = True And Me.chk71201 = True And Me.chk71203 = True Then
Sheets(Array("7120R", "71201R", "71203R")).PrintPreview
ElseIf Me.chk7120 = True And Me.chk71201 = True And Me.chk71202 = True Then
Sheets(Array("7120R", "71201R", "71202R")).PrintPreview
ElseIf Me.chk7120 = True And Me.chk71203 = True Then
Sheets(Array("7120R", "71203R")).PrintPreview
ElseIf Me.chk71201 = True And Me.chk71202 = True Then
Sheets(Array("71201R", "71202R")).PrintPreview
ElseIf Me.chk7120 = True Then
Sheets("7120R").PrintPreview
ElseIf Me.chk71201 = True Then
Sheets("71201R").PrintPreview
ElseIf Me.chk71202 = True Then
Sheets("71202R").PrintPreview
ElseIf Me.chk71203 = True Then
Sheets("71203R").PrintPreview
End If
Me.Show
End Sub
Bookmarks