ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   protect format - page setup (https://www.excelbanter.com/excel-discussion-misc-queries/13505-protect-format-page-setup.html)

kva

protect format - page setup
 
I've protected parts of my sheet, but also want to protect it's format. I
don't want the user to use page setup to alter the appearance. Any
suggestions?


Dave Peterson

I don't think you can stop them.

But you could use the workbook_beforeprint event to put things back to what you
want.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)

With Worksheets("sheet1").PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
.PrintArea = ""
.LeftHeader = ""
.CenterHeader = ""
'.etc....
End With

End Sub

This kind of code goes into the ThisWorkbook module.

(I'd just record a macro when I set it exactly the way I want. Then paste that
code into that module--and adjust the Activesheet references.)

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm


kva wrote:

I've protected parts of my sheet, but also want to protect it's format. I
don't want the user to use page setup to alter the appearance. Any
suggestions?


--

Dave Peterson


All times are GMT +1. The time now is 10:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com