+ Reply to Thread
Results 1 to 4 of 4

Hide a section based on the click of a box in the beginning of the section

  1. #1
    Registered User
    Join Date
    05-08-2013
    Location
    Monterey, California
    MS-Off Ver
    Excel 2007
    Posts
    40

    Hide a section based on the click of a box in the beginning of the section

    I have a document that has "Is Not Applicable" boxes in the beginning of many of the sections in it. If the user clicks the boxes an "X" will be placed within them. They in addition want to hide everything within that section if the author clicks the "Is Not Applicable".


    I tried to record a macro to identify the buttons, so I can create conditional code for when they are on/off but I cannot click the buttons when I am in record mode, and cannot seem to identify them either. I would assume a conditional statement of if button is clicked then perform hide action would be the way to go, but I cannot figure it out.

    Any help would be greatly appreciated - I am new to Word Programming but have done a lot of excel VBA macros.


    I have attached a word document that hopefully demonstrates what I am talking about.

    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Guru macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,725

    Re: Hide a section based on the click of a box in the beginning of the section

    You cannot reliably hide content that way. Although content can be formatted as hidden text, whether that content remains visible or prints (even if not visible) is at the mercy of the user's Word configuration, not anything that you might change in the document itself. You can, however, use field coding for conditionally displaying text & graphics. See, for example:
    http://www.msofficeforums.com/word/1...html#post52434
    Note though that this won't work for conditionally displaying/hiding formfields.

    The attachment to this post shows how to conditionally delete content:
    http://www.msofficeforums.com/word/6...html#post16062
    You may also wish to be able to restore content that has been erroneously deleted:
    http://www.msofficeforums.com/word/1...html#post30792
    Obviously, though, if you delete the checkbox along with the related content, restoring the deleted content is going to be rather difficult... See also:
    http://www.techsupportforum.com/foru...de-606391.html

    I note that your document contains a Table of Contents. You'll find it difficult to update that while the document is using forms protections, which your document will require for the formfields to work. Since you'll need to temporarily unprotect the document to add/delete content, you should update the TOC at that time.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    05-08-2013
    Location
    Monterey, California
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Hide a section based on the click of a box in the beginning of the section

    Paul - thanks for your help. I am trying from a different route now by expanding or collapsing sections based on a macro:

    http://www.wikihow.com/Expand-and-Co...Microsoft-Word

    This seems to kind of work, however I can't get the macro to run based on the click in the box (which is what I want).

    Sub-section
    ☐ NOT APPLICABLE
    0 Unit is ok
    0 Unit is faulty

    Any ideas on how to do that?

    Eric

  4. #4
    Forum Guru macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,725

    Re: Hide a section based on the click of a box in the beginning of the section

    Without wanting to place too fine a point on it, that approach is doing nothing different to what you already had in mind. It is not expanding or collapsing the text. All it is doing is changing the font attibrutes to hidden /not hidden.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 06-16-2013, 07:36 AM
  2. Deleting Row Section without Disrupting Formula Range Outside of Deleted Section
    By JeffNYG23 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-14-2013, 09:10 AM
  3. [SOLVED] Inserting text at the beginning of a section of data and at the end
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2013, 08:59 PM
  4. Moving section headings from below section to above section..
    By Fayebaline in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-24-2011, 06:58 AM
  5. [SOLVED] how to hide section of worksheet based on a condition (e.g. tick .
    By kitepuppet in forum Excel General
    Replies: 2
    Last Post: 03-04-2005, 03:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1