+ Reply to Thread
Results 1 to 3 of 3

Protection Property

  1. #1
    MWS
    Guest

    Protection Property

    I need to systematically determine if a worksheet is protected or not, so
    then I can create the if statement to do some events if the worksheet is
    protected and other events if it is not protected.

    I thought I would be able to do so via the worksheets properties, but am now
    very confused.

    ANy and All Help Is Appreciated - Thank You

  2. #2
    Jim Thomlinson
    Guest

    RE: Protection Property

    I am not too sure which level of protection you need to catch (probably
    contents) but here is a function...

    Sub TestProtection()
    MsgBox IsProtected(Sheet1)
    MsgBox IsProtected(Sheet2)

    End Sub

    Public Function IsProtected(ByVal wks As Worksheet) As Boolean

    If wks.ProtectContents = True Or _
    wks.ProtectDrawingObjects = True Or _
    wks.ProtectScenarios = True Then
    IsProtected = True
    Else
    IsProtected = False
    End If

    End Function
    --
    HTH...

    Jim Thomlinson


    "MWS" wrote:

    > I need to systematically determine if a worksheet is protected or not, so
    > then I can create the if statement to do some events if the worksheet is
    > protected and other events if it is not protected.
    >
    > I thought I would be able to do so via the worksheets properties, but am now
    > very confused.
    >
    > ANy and All Help Is Appreciated - Thank You


  3. #3
    MWS
    Guest

    RE: Protection Property

    Thank You Jim - I Appreciate Your Help!!!!

    "Jim Thomlinson" wrote:

    > I am not too sure which level of protection you need to catch (probably
    > contents) but here is a function...
    >
    > Sub TestProtection()
    > MsgBox IsProtected(Sheet1)
    > MsgBox IsProtected(Sheet2)
    >
    > End Sub
    >
    > Public Function IsProtected(ByVal wks As Worksheet) As Boolean
    >
    > If wks.ProtectContents = True Or _
    > wks.ProtectDrawingObjects = True Or _
    > wks.ProtectScenarios = True Then
    > IsProtected = True
    > Else
    > IsProtected = False
    > End If
    >
    > End Function
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "MWS" wrote:
    >
    > > I need to systematically determine if a worksheet is protected or not, so
    > > then I can create the if statement to do some events if the worksheet is
    > > protected and other events if it is not protected.
    > >
    > > I thought I would be able to do so via the worksheets properties, but am now
    > > very confused.
    > >
    > > ANy and All Help Is Appreciated - Thank You


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1