Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts

    test if a control is locked (VBA/Word 2003)

    Dear loungers

    what is the correct syntax to allow me to test if a contol on a form is defined as locked and/or enabled?

    thanks....... liz

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: test if a control is locked (VBA/Word 2003)

    Say you have a control TextBox1. Depending on whether you want to test for the text box being locked or unlocked, you can use

    If Me.TextBox1.Locked Then

    or

    If Not Me.TextBox1.Locked Then

    Similarly, depending on whether you want to test for the text box being enabled or disabled:

    If Me.TextBox1.Enabled Then

    or

    If Not Me.TextBox1.Enabled Then

  3. #3
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: test if a control is locked (VBA/Word 2003)

    The reason I asked was that although this felt right to me it didn't appear in the intellisense list. I suppose that is because it doesn't apply to every control... such as labels? I suppose I should have tried it anyway.

    thank you

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: test if a control is locked (VBA/Word 2003)

    If you have something like

    Dim ctl As Control

    you won't see Enabled and Locked in the popup list of properties, for the exact reason you mention - these properties don't apply to *all* controls. If you declare the variable as

    Dim ctl As TextBox

    you *will* see Enabled and Locked in the IntelliSense list.

Posting Permissions

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