Results 1 to 6 of 6
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Forms checkboxes (W97, WinNT4)

    Could someone please tell me how I can programmatically affect the value of a checkbox on an unprotected form? The reason I need to affect it while unprotected is that I am using a userform to fill in the variables and I don't think I'll be able to if it's protected at the time ...

    If I try to record the steps, it won't let me rightclick to access the properties and doubleclicking doesn't work, and if I protect the form so I can 'check' it (with mouse or spacebar) I can't record because it won't let me record on a protected sheet!

    <img src=/S/hairout.gif border=0 alt=hairout width=31 height=23> <img src=/S/bwaaah.gif border=0 alt=bwaaah width=123 height=15>
    Beryl M


  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Forms checkboxes (W97, WinNT4)

    <font color=blue>ActiveDocument.FormFields(1).CheckBox.V alue = False </font color=blue> seems to work fine whether the form is protected or not, you may need to replace the 1 with a different number or name for your particular form.

    StuartR

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Forms checkboxes (W97, WinNT4)

    That's great, Stuart, thanks, and it looks like it should work - but I'm not sure about the name? If you look at the properties of a checkbox it doesn't seem to have a name, only a bookmark, and changing the 1 to the bookmark name doesn't help ...?
    Beryl M


  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Forms checkboxes (W97, WinNT4)

    Trial and error shows that you can use the bookmark name, as in <font color=blue>ActiveDocument.FormFields("Check1").Che ckBox.Value = True</font color=blue>

    StuartR

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Forms checkboxes (W97, WinNT4)

    Well, I have to say that's what I thought and the example you give is exactly how I tried it, but it didn't work for me!
    Beryl M


  6. #6
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Forms checkboxes (W97, WinNT4)

    You're not going to believe this - although my last post is true, I did try exactly your suggestion - I told it that if xxx was true it should mark the value of the checkbox as false (which it was already) instead of true! Of course it didn't work!

    Changing it to true sorted it.

    <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15> You can tell it's Friday afternoon here, can't you?! <img src=/S/stupidme.gif border=0 alt=stupidme width=30 height=30>

    Many thanks!
    Beryl M


Posting Permissions

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