View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Nick Hodge Nick Hodge is offline
external usenet poster
 
Posts: 1,173
Default Macro to Print all worksheets in workbook

Dean

This will unprotect a sheet at a time, print it and re-protect, you can add
more parameters if you need but many in the example you gave are defaults
and therefore don't need to be explicitly set

Sub PrintAllWorksheets()
Dim wks As Worksheet
For Each wks In Worksheets
wks.Unprotect Password:="WhatEver"
wks.PrintOut
wks.Protect Password:="Whatever"
Next wks
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Dean" wrote in message
...
Yes, I like that, too.

How do I change it to unprotect all sheets?

Also to protect all sheets with:

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
_
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True

Thanks guys!
Dean

"Nick Hodge" wrote in message
...
Dean

Or a different reading of the question from Jason

Sub PrintAllWorksheets()
Worksheets.PrintOut
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Dean" wrote in message
...
Can someone give me macro to print all worksheets in a workbook? Thank
you.
Dean