Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Print Workbook Command Button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sprinks - 25 Jan 2006 16:17 GMT
We estimate construction projects for architectural clients, submitting them
as an Excel workbook.  Frequently our clients have few Excel skills and don't
realize that the estimate detail is frequently broken up by project area or
trade on separate worksheets, so they are confused why we've provided a
summary only and no detail.

I'd like to attach the following macro, which works, to a command button to
simplify the print process for them.  Of course, I don't want to print an
image of the button, but would like it visible at all times.

Can anyone tell me how to do this?

Thanks, Sprinks

Public Sub PrintWorkbook()
   On Error GoTo ErrorHandler
   Dim wrksht As Worksheet
   Dim cursht As Worksheet
   
   Set cursht = ActiveSheet
   Application.ScreenUpdating = False
   For Each wrksht In ActiveWorkbook.Worksheets
       If wrksht.Visible = xlSheetVisible Then
           ActiveWindow.View = xlNormalView
           wrksht.Activate
           wrksht.PrintOut
       End If
   Next wrksht
   cursht.Activate

SubExit:
   Application.ScreenUpdating = True
   Exit Sub
   
ErrorHandler:
   MsgBox "There has been the following error.  Please contact the macro
administrator." & _
           vbCrLf & "Error Code: " & Err.Number & "  " & Err.Description
           GoTo SubExit
End Sub
Patrick Molloy - 25 Jan 2006 16:30 GMT
if its a button from the forms menu. right click on it, select Format
Control, and in the Format Comtrol form click the Properties tab. there's a
check box that needs to be unchecked there

> We estimate construction projects for architectural clients, submitting them
> as an Excel workbook.  Frequently our clients have few Excel skills and don't
[quoted text clipped - 36 lines]
>             GoTo SubExit
> End Sub
Sprinks - 25 Jan 2006 19:35 GMT
Patrick,

As of now, I don't have a button.  I'd like to place one on the body of the
worksheet for them.

Sprinks

> if its a button from the forms menu. right click on it, select Format
> Control, and in the Format Comtrol form click the Properties tab. there's a
[quoted text clipped - 40 lines]
> >             GoTo SubExit
> > End Sub
Crowbar - 25 Jan 2006 19:55 GMT
Insert this into the sheet that contains the print button, this will hide it
from printing
You might have to rename commandbutton1()

Sub auto_open()

With CommandButton1()
       
       .PrintObject = False

End With

End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.