Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Bronze Lounger
    Join Date
    Sep 2002
    Location
    Naples, Florida, USA
    Posts
    1,231
    Thanks
    40
    Thanked 3 Times in 3 Posts

    Question Clear Radio Buttons in Word 2007

    I've been trying to find an answer I can understand all over the Internet, but without success. Hope it's a question a Lounger can help me with!

    Issue:
    • Created a multiple choice list using Forms/Developer/Radio Buttons in Word 2007.
    • Managed to get all the choices into groups so only 1 option can be selected.
    • Saved form as both docm and docx and even dotm in Templates.
    • List is to be downloadable from web site and printed by users after filling in selections.
    • How do I get the choices I made to test the form to disappear so the form is blank for new users?

    Thought I'd found the answer as one forum post suggested changing Properties of each option to False, but I couldn't find a True to change to False that worked!!

    Suggestions, links, ideas gratefully accepted!

    Linda

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,433
    Thanks
    371
    Thanked 1,456 Times in 1,325 Posts
    Linda,
    Code:
    Sub Form_Initialize() 
      OptionButton1.value = False   '...repeat for each OptionButton. 
    End Sub
    Place Code in the Form object using the VBE {Alt+F11}
    OptionButton.PNG
    OptionButtonCode.PNG
    Last edited by RetiredGeek; 2013-02-05 at 18:10.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    Bronze Lounger
    Join Date
    Sep 2002
    Location
    Naples, Florida, USA
    Posts
    1,231
    Thanks
    40
    Thanked 3 Times in 3 Posts
    Thank you so much for your super fast reply, RG. I've tried and tried but can't recreate the screens you show in your screen shots. I realize I'm to copy the code you provided (thanks!) and somehow paste it into the main document so that it will apply to all buttons. I can't get a VBA screen that looks as if there's a place for the code. I'm also puzzled by the weird numbering I see in the code box: my document's buttons run from #1 to #51 but those numbers aren't there (see screen shot).

    Here's what I've tried:
    • Working with docm document in Developer mode.
    • I've used F11 with results you see in second screen shot.
    • I can get a window that has Appearance at the top like yours (first screen shot), but it's only when I click on Properties for one button.

    There's obviously some simple thing I'm missing. This is the first form I've attempted and certainly the first time working with VBE or macros!

    Is there any way you can give me a little more direction? I'm going to come back at this early in the morning when my head is clearer!

    Linda
    OptionButton1.JPGResults of F11.JPG

  4. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,433
    Thanks
    371
    Thanked 1,456 Times in 1,325 Posts
    Linda,

    AH! Now I see said the Blind Man...

    You have your buttons directly in the document where I was creating a UserForm.

    So what you need is:
    Code:
    Option Explicit
    
    Sub Document_Open()
    
       OptionButton1.Value = False
       OptionButton2.Value = False
       OptionButton3.Value = False
    
    End Sub
    This goes in the This Document area of the VBA editor.
    Document Radio Buttons.PNG
    HTH
    Attached Files Attached Files
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  5. #5
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Assuming all the option buttons are positioned inline in the document the following code will wipe them all
    Code:
    Sub VoidOptionsButtons()
      Dim oShape As InlineShape
      For Each oShape In ActiveDocument.InlineShapes
        If oShape.OLEFormat.ProgID = "Forms.OptionButton.1" Then
          oShape.OLEFormat.Object.value = False
        End If
      Next
    End Sub
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  6. #6
    Bronze Lounger
    Join Date
    Sep 2002
    Location
    Naples, Florida, USA
    Posts
    1,231
    Thanks
    40
    Thanked 3 Times in 3 Posts
    Thanks to you both! I think, from what you said, RG, that I should have created a UserFrom first! Will try to do that next time, but would I be better to start over and create a UserForm now do you think?

    Just before I give your suggestions a try, 3 follow up questions:
    RG: Do I need to include all 51 option buttons in the code list and make them all False?
    Andrew: not sure what is meant by "inline" - sorry:
    Quote Originally Posted by Andrew Lockton View Post
    Assuming all the option buttons are positioned inline in the document
    Both: Will both codes allow a blank but fill-in-able document to appear when a new user opens it?

    I really appreciate all the help and apologize for being a tad dense!

    Linda
    Last edited by IreneLinda; 2013-02-06 at 10:52. Reason: Added UserForm question

  7. #7
    Bronze Lounger
    Join Date
    Sep 2002
    Location
    Naples, Florida, USA
    Posts
    1,231
    Thanks
    40
    Thanked 3 Times in 3 Posts

    Progress Update

    By way of update: Sheesh! I really admire you guys for being able to do this!

    I've tried both codes but nothing changed. Well, yes, RG, after trying yours, I got an options error (see screen shot - it highlighted OptionsButton2, not shown). I noticed that Optionbutton1's value had changed Enable from True to False which faded it out. I reset that to True (corrected fade out) and tried pasting code again - no success.

    Also tried Andrew's code with similar results (that is, when I save code and close and reopen document, the selected responses from my test are still there). Got an error message after pasting that said I was changing the ??? - forgot word used, sorry - of my document and did I want to proceed - I said Yes .

    Hope the attached shots will show you where I put the code. When I inserted it, Declarations changed to Open.

    Other issue that puzzles me is that the list of OptionButtons is not in order from 1 to 51 (although they are sequenced in the document): #3 comes before 30; #4 before 40; #5 before 50 and then #6, 7, 8, 9, 2 all come after 51. Is this a problem?

    Beginning to think this is a bit beyond me. If you have patience to try one more time. let's; otherwise, not to take up any more of your time, maybe I should just save this as it is and get a "geek" to do what's needed when it's time to post it on our site. I was trying to do it myself to see how it worked.

    Thanks and here are the screenshots ...

    Code Inserted.JPGError Message.JPG
    Last edited by IreneLinda; 2013-02-06 at 12:02.

  8. #8
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    If you want my macro to run every time you open the document, change its name to AutoOpen.
    This means the first line of the code changes to
    Sub AutoOpen()

    Alternatively, since you are using the ThisDocument to place your code, you could rename my macro to Document_Open.

    Personally, I wouldn't want these macros to run every time a document is opened - what if someone is only half way through the form and wants to come back to finish it later? Instead, I would run the code once to wipe all the entries and then save the document as a template. When a user creates a new document from that template it is already blank and doesn't need the code to run. They can make changes and save it as they like or just throw it away when done. When they want to do another form, they just choose the template again and they start from the emptied form which wasn't changed by their previous form-entry efforts.

    Inline graphics are ones that are positioned in a document as normal. The alternative is floating graphics which are positioned to have text flow around, under or over them. The code works for the inline graphics but could be augmented to also handle floating versions of the option buttons.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  9. #9
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,433
    Thanks
    371
    Thanked 1,456 Times in 1,325 Posts
    Linda,

    Can you post a copy of your document?
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  10. #10
    Bronze Lounger
    Join Date
    Sep 2002
    Location
    Naples, Florida, USA
    Posts
    1,231
    Thanks
    40
    Thanked 3 Times in 3 Posts
    I follow what you said, Andrew, and agree now that I understand what a running macro would do when the document is opened. Also like the solution of getting a blank version created with your code line; then, saving it as a template (would that be dotm or dotx?) and linking to the template version from the site.

    RG, do I post a screen shot of it? In case that's what you meant, it's here as dotm. Have also save it as docx and docm. You can tell I'm totally confused as to what I need here! Duh.

    Skill Checker.docm
    Last edited by IreneLinda; 2013-02-06 at 20:49.

  11. #11
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,433
    Thanks
    371
    Thanked 1,456 Times in 1,325 Posts
    Linda,

    If you are going the template route here's how to set all the options to not selected manually.
    On the Developer Tab select Design Mode.
    Select an Option Button that has its circle filled {selected}
    Right-Click and select Properties.
    Change the Value property to False.
    LindaOptionButton.PNG
    You can now select the the other Option Buttons from the drop down at the top of the Properties box and work through them to make sure all Value properties are set to False.

    Note: I only did the first two groups in the graphic above.

    Also, if you use code you need it as a .docm without code a .docx is fine.

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  12. #12
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Linda

    The file format you choose depends on how you are making the file available. It sounds like you are putting a link to it on a html page so the user will need to download it in order to open it. This means that no-one can write to this location except you. Based on this assumption, and also assuming that any user who wants to do a second pass at the form will download a new one, I would:
    1. Put the macro in your own Normal.dotm template
    2. Run the macro on the form to clear all entries
    3. Save the form as a docx and make it available on your website/intranet


    If you expect the users to retain a copy of the form so they can reopen it at a later date then I would choose to save the form as .docm and include the macro in the form itself and add a macrobutton field on the form that they can doubleclick it to clear the form if they wish.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  13. #13
    Bronze Lounger
    Join Date
    Sep 2002
    Location
    Naples, Florida, USA
    Posts
    1,231
    Thanks
    40
    Thanked 3 Times in 3 Posts
    Thanks again. It's been a long day and my brain isn't processing too well at the moment. Will come back at this in the morning (that' morning here in Florida!) and try things out.

    One question as I'm thinking: this downloadable is a "band aid" solution until we can get the feature programmed. The original intent was to have a user download a blank Word form and fill it in by hand. Then, when I found this form feature in Word 2007, I thought maybe we could make the user experience a bit better by having the form fill-able on line and then printed.

    Question: Do you think I should just stick with original idea and forget this macro and VBA stuff? I don't want to mess up the user as we are still without IT help. Guess I'm asking if I can make it work as we've been trying to in this thread or ...? Realize you can't make the decision for me, but interested in your opinions!

    Further Thoughts: after discussion with my business partner (also husband), decision is to go with an online fill-able form - our target market would likely never print it out to do it addicted as they are to just clicking!

    Sure appreciate your help and I'll try your ideas out regardless of the above Q and A.

    Linda
    Last edited by IreneLinda; 2013-02-08 at 10:00. Reason: added Further Thoughts

  14. #14
    Bronze Lounger
    Join Date
    Sep 2002
    Location
    Naples, Florida, USA
    Posts
    1,231
    Thanks
    40
    Thanked 3 Times in 3 Posts
    Okay, this all makes more sense this morning!

    Quote Originally Posted by Andrew Lockton View Post
    It sounds like you are putting a link to it on a html page so the user will need to download it in order to open it. This means that no-one can write to this location except you. Based on this assumption, and also assuming that any user who wants to do a second pass at the form will download a new one, I would:
    1. Put the macro in your own Normal.dotm template
    2. Run the macro on the form to clear all entries
    3. Save the form as a docx and make it available on your website/intranet


    If you expect the users to retain a copy of the form so they can reopen it at a later date then I would choose to save the form as .docm and include the macro in the form itself and add a macrobutton field on the form that they can doubleclick it to clear the form if they wish.
    As you have both deduced, yes, we're planning to use it exactly as described by Andrew. To be totally clear:

    "Put the macro in your own Normal.dotm template":
    - do you mean RG's macro?
    - do I correct the document using RG's instructions; then, save the resulting document as a dotm in my Templates folder?
    - sounds more like the macro itself is what's saved in Normal template - is that done when I save the document with RG's fixes in my Normal dotm?
    - but that doesn't fit with "Run the macro on the form to clear all entries", or am I missing something?

    Will work on correcting the form following RG's great directions and maybe try some options with Andrew's 3 to see what works. As always, will be back ...

    Many thanks again!

    Linda

  15. #15
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,433
    Thanks
    371
    Thanked 1,456 Times in 1,325 Posts
    Linda,

    If you have no other code then you don't need any code from what I understand you want to do.
    Clear the Radio Buttons using the instructions I gave you and then save the document as a .doc!
    Yes, I did say .doc. You don't have anything that I can see that is 2007+ only so I'd save it as .doc so it is compatible with the maximum amount of users. You also don't need it as a template since each user will download their own copy, unless I'm missing something here?

    HTH

    Update: You also won't have to worry about Macro security problems in 2007+ when the user downloads it!
    Last edited by RetiredGeek; 2013-02-08 at 10:41.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

Page 1 of 2 12 LastLast

Posting Permissions

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