Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Despearte for help printing from a UserForm

Status
Not open for further replies.

Hornet2433

Technical User
Jul 23, 2003
8
0
0
US
Help!!! I am running out of time before my program is due, and I am relatively new to the world of VBA, any help is greatly appreciated.

I have a workbook that consists of numerous worksheets. I have set up a userform that allows the user to check which sheets he/she would like to have printed. It is not necessary to print all of the sheets, but which ones depends on the user. Also, I need to be able to differentiate between visible and hidden sheets, not printing those that are hidden....

If my user selects their boxes, and then clicks the print option button in the userform, what code would i use to execute the printing process?

I appreciate any help or suggestions.... also sorry if this does not make much sense... it is 3:30 am...

Thanks [bomb]
Hornet
 
Hi,

Not knowing what the sheet selection objects are (maybe check boxes)
Code:
    On Error Resume Next
    With UserForm1
      For Each ctl In .Controls
        If ctl.DisplayStyle = fmDisplayStyleCheckBox Then
            If Err.Number = 0 Then
                If ctl Then _
                Worksheets(ctl.Caption).PrintOut
            End If
        End If
      Next
    End With
Hope this helps :)


Skip,
Skip@TheOfficeExperts.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top