Consulting

Results 1 to 4 of 4

Thread: Protecting Page SetUp Properties

  1. #1
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location

    Protecting Page SetUp Properties

    protecting worksheet contents is pretty easy, but what if you want to protect, say, page setup properites, e.g., margins. One can disable the Page SetUp menu pick, but there are other ways to get to those properties; and disabling all avenues is pretty drastic.

    I poked around the ojbect browser looking for something that might enable/disable page setup properties but found nothing

    Any thoughts?

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Instead of disabling them, just set them with a macro. You can run the macro before the file is printed to ensure that it will always be set the way you want.

  3. #3
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Quote Originally Posted by DRJ
    Instead of disabling them, just set them with a macro. You can run the macro before the file is printed to ensure that it will always be set the way you want.

    Exactly, there is a ThisWorkbook Before_Print you can use for this:

    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    'put all your settings here
    End Sub

    HTH
    John
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  4. #4
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location
    Quote Originally Posted by johnske
    Exactly, there is a ThisWorkbook Before_Print you can use for this:[vba]Private Sub Workbook_BeforePrint(Cancel As Boolean)
    'put all your settings here
    End Sub[/vba]

    HTH
    John
    An interesting approach. I use that proc a lot but never thought about using it to override any page setup properties changed by a user.

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •