Avatar of Nenad Ilic
Nenad Ilic

asked on 

checkbox to hide entire section

Hi guys,
I would need your help. I have a document with several sections (i.e. Services), and the idea is to create checkboxes on start. If we select one service, the section regarding it is shown, if we don't select it, it remains hidden.
Example
Service 1
Service 2
Service 3

Section Service 1 (with content bellow)
Section Service 2 (with content bellow)
etc.

So services that i select with checkbox are visible and the ones that are not, remain hidden. (also it would be good if there is a possibility to keep the sorting, that if I select first Service 2, then Service 1, to still be in the document in line).

I'm quite new in this and I would really appreciate all the help I could get.
Microsoft WordMicrosoft OfficeVisual Basic ClassicVBA

Avatar of undefined
Last Comment
Nenad Ilic
Avatar of Ramin
Ramin

Try the attached file, with clicking on the triangle you can also hide everything except the header.
ZZZZ.docx
Avatar of Nenad Ilic
Nenad Ilic

ASKER

Hi Ramin,
thank you for your reply, but what I was going for is something else.

I've attached a quick example with 2 checkboxes, now, what I need is to "unhide" the service that is been selected, or keep it "hidden" if it's not selected.

Could you please provide me with any possible solution for that?

Kind regards,

Nenad
Avatar of Paul Sauvé
Paul Sauvé
Flag of Canada image

@Nenad
I've attached a quick example with 2 checkboxes, now, what I need is to "unhide" the service that is been selected, or keep it "hidden" if it's not selected.
No attached file ;-)
Avatar of Nenad Ilic
Nenad Ilic

ASKER

My bad, forgot to press "upload file" button :)
example.docx
Avatar of Nenad Ilic
Nenad Ilic

ASKER

Ark, I've looked into that one before, and at the end someone asked the similar question as mine (How would you apply this to multiple sections as well), and it was advised to ask a separate question.
Which led me to a thought that the solution might be bit different.

On the solution https://www.experts-exchange.com/questions/22703028/Macro-to-Display-Hide-Section-of-a-Word-Document.html
GrahamSkan gave a great idea and code, I tried to use it (using his code replacing the "Section2" with "Service1" - from my example) but I did not get it running.
And I've selected entire section as autotext, and followed all the guidelines.
Avatar of Nenad Ilic
Nenad Ilic

ASKER

The solution definitely doesn't work. If anyone could provide further assistance or help, I would appreciate it
Avatar of Paul Sauvé
Paul Sauvé
Flag of Canada image

maybe you can find something useful to adapt to your needs here:Toggle Data Display
...

Applications for this type of document might include:
  • A schedule of events with the display of event details hidden unless a user elects to see the details.
  • A procedure might have general steps with an option to display more detailed instructions.
  • Teachers might prepare a set of math problems with the option to display how the problem is worked out, or a set of question with an option to display the answers.

This Microsoft Word Help & Microsoft Word Tips page provides some methods and techniques to allow the document user to show/hide (or expand/collapse) document content.
...
http://gregmaxey.com/word_tip_pages/toggle_data_display.html
ASKER CERTIFIED SOLUTION
Avatar of Ark
Ark
Flag of Russian Federation image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Nenad Ilic
Nenad Ilic

ASKER

This did the work, thank you very much for this, I appreciate it
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo