S
Sprinks
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
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