Consulting

Results 1 to 8 of 8

Thread: Show and hide table rows with checkboxes in Word

  1. #1
    VBAX Newbie
    Joined
    Mar 2024
    Posts
    3
    Location

    Show and hide table rows with checkboxes in Word

    Hello,

    I need help implementing a task in Word. Unfortunately, I have no experience with VBA and my own research for a solution
    was unsuccessful. I would like to integrate the following function into a Word document:

    The Word document essentially consists of tables. The tables have different numbers of rows and two columns. The first
    column should only contain text. There should be a checkbox in the second column. The checkboxes should initially be hidden.
    The checkboxes should only become visible when you activate the “Show all” function.

    If the check box is selected, the text in column 1 should have a specific target style assigned to it. If the check box is
    cleared, the text should be mapped to another style that is defined to have the text hidden. If I deactivate the "Show all"
    function again, I want the rows whose checkboxes were deactivated to no longer be visible.



    So ultimately I want to be able to easily control what I can and can't see in my document using the checkboxes.
    Is this possbile in Word with VBA?

    Thanks in advance for an answer Kind regards, Daniel

  2. #2
    VBAX Contributor
    Joined
    Jul 2020
    Location
    Sun Prairie
    Posts
    126
    Location
    Possible? I suspect so.
    Easy? Maybe not.
    The checkboxes would be comment controls and formatted as hidden text under the font menu, probably best done using a paragraph style.
    The other text, that you want to hide, should also be formatted using a separate paragraph style.
    See Greg Maxey's work on On-Exit macros for content controls. Note that checking the box is Not an exit.

    Content Control Custom Events by Greg Maxey

    I would have this in a template and rather than hiding text, delete the rows in documents created from the template.

    Templates in Microsoft Word

  3. #3

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,232
    Location
    Well thats disappointing to read, particularly after the assistance you had offered Chas.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  5. #5
    VBAX Newbie
    Joined
    Mar 2024
    Posts
    3
    Location
    Through your post I understood what the problem with corss posting is. Not to excuse the matter, but I'm new to forums and didn't know. I read the homepage carefully and understood it and will take it into account in the future. Sorry

  6. #6
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,232
    Location
    Thank you for having the courage to apologise.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  7. #7
    VBAX Newbie
    Joined
    Mar 2024
    Posts
    3
    Location
    Through my further research, I came across a similar problem in a forum and was now able to change the code so that I achieved the function I wanted. So this thread is solved

  8. #8
    VBAX Contributor
    Joined
    Jul 2020
    Location
    Sun Prairie
    Posts
    126
    Location
    I am glad you found a solution.
    Almost everyone cross-posts at some time looking for help; I have, and was referred to the same article.
    My referring you to that page, as it said, is not because I think ill of you but to let you know the etiquette.

Tags for this Thread

Posting Permissions

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