1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

How to add checkboxes to MS Word 2000?

Discussion in 'Business Applications' started by peterc, Feb 2, 2004.

Thread Status:
Not open for further replies.
Advertisement
  1. peterc

    peterc Thread Starter

    Joined:
    Feb 2, 2004
    Messages:
    57
    Hi,

    I want to create a MS Word doc with checkboxes which others can check and uncheck. I have found out that I can add checkboxes by using Control Toolbox. I believe I need to write some VB code in the click event of each checkbox. I have added coding like this:


    if checkbox1.value then
    checkbox1.value = false
    else
    checkbox1.value = true
    end if

    After I saved the doc, when I open the doc, it will ask me whether to enable or disable macro. After the doc is opened, clicking on a checkbox sometimes will bring up the code editor or sometimes simply does nothing.

    My expectation is that when I send this doc to others, others can click on those checkboxes to check or uncheck but they won't able to see the VB coding.

    Thank you for any help.
     
  2. XL Guru

    XL Guru

    Joined:
    Aug 30, 2003
    Messages:
    2,702
    >> After the doc is opened, clicking on a checkbox
    >> sometimes will bring up the code editor

    This happens when you're in design mode.

    Design mode is toggled on & off with the first button on the (View -- Toolbars --) Control Toolbox.

    For fill-in forms without code, have a look at the Text, Check Box & Dropdown form field options instead. You place these where required in your form, then (Tools -- ) Protect the document for forms. Users can then use the Tab key to step through the fields.

    Rgds,
    Andy
     
  3. peterc

    peterc Thread Starter

    Joined:
    Feb 2, 2004
    Messages:
    57
    HI XL Guru,

    Thank you for the information. I'm very interested in knowing how to do a simple VB coding with Word (like the check box in my case). I hope you can tell me how or refer me to some articles.


    Thank you,

    Peter
     
  4. XL Guru

    XL Guru

    Joined:
    Aug 30, 2003
    Messages:
    2,702
    Hi Peter.

    I guess I was kind of steering away from the VBA side ; mainly because it looked like you just wanted a box on the page that could be clicked, for which code would be OTT.

    What do you want clicking the box to achieve?

    Rgds,
    Andy

    EDIT:

    Private Sub CheckBox1_Click()
    If CheckBox1.Value = True Then
    MsgBox "Checked."
    Else
    MsgBox "Unchecked."
    End If
    End Sub

    or

    Private Sub CheckBox1_Click()
    If CheckBox1.Value = True Then
    do stuff
    Else
    do other stuff
    End If
    End Sub
     
  5. peterc

    peterc Thread Starter

    Joined:
    Feb 2, 2004
    Messages:
    57
    Hi Andy,

    You're right that for my current purpose, I can use the form field as you suggested. I believe there will be time that I may want to use VB with Word. So, I want to explore this earlier so I won't get caught in a rush when I need it. Also, the checkbox from Control Toolbox has caption.

    I have just tried it again by doing the following:

    1. adding a checkbox using Control Toolbox (no coding added)
    2. save the doc
    3. open the doc and click on the enable macros button
    4. check and uncheck the checkbox

    This seems to work fine. Is there any way to suppress the dialog box "disable macros, enable macros"? I guess I should protect the document too so others cannot change the checkbox properties and/or coding.

    Thank you for your help,

    Peter
     
  6. XL Guru

    XL Guru

    Joined:
    Aug 30, 2003
    Messages:
    2,702
    >> suppress the dialog box "disable macros, enable macros"?

    That there's a trade-off for including anything VBA related.

    I think most, if not all, people would recommend that you don't set Security to Low (via Tools -- Macros -- Security) (especially with the amount of virus cr*p flying around at the moment).

    Regrets,
    Andy
     
  7. peterc

    peterc Thread Starter

    Joined:
    Feb 2, 2004
    Messages:
    57
    Hi Andy,

    I totally agree with you about the security issue. If I use any VBA with Word, the documents will be the internal one only.


    Thank you for your help.
     
  8. XL Guru

    XL Guru

    Joined:
    Aug 30, 2003
    Messages:
    2,702
    You're very welcome.

    Rgds,
    Andy

    (Can we get rid of this darn snow now? G'night all).
     
  9. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/200292

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice