+ Reply to Thread
Results 1 to 5 of 5

Hide/Show page within document.

  1. #1
    Registered User
    Join Date
    07-13-2014
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2010
    Posts
    7

    Hide/Show page within document.

    Hi

    With thanks to Bernie for his advice and assistance on my last query, I have now moved on to yet another problem!

    I have a Userform in Word, with ComboBoxes which in turn populate DocVariables on my document. That's all fine and works for me as it should.

    The information from the Userform is used to populate a 'service document' for each party named on it. At the moment I have slots for two individuals on the Userform and so two 'service documents' on the document, with DocVariables ready to go.

    The problem I am faced with is that, if there is no second individual, the second 'service document' is still visible even though it isn't needed. What I'd like to be able to do is code it so that if the ComboBox for the second individual's name is blank - then the second 'service document' should be hidden from view. I'm at a loss how to do this myself.

    Any help would be gratefully received.

    Thanks

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

    Re: Hide/Show page within document.

    You cannot reliably hide document content. Even though you can format text as hidden, or use a field code to conditionally display it. Whether the text actually remains hidden or even prints cannot be controlled this way. For example, whether text formatted as hidden is visible, can be changed just by clicking on the ¶ character on the Ribbon's Home tab. Similarly, whether text formatted as hidden prints depends on whether Word is set to print hidden text - and this is completely independent of its on-screen visibility. If you don't want content to be revealable, on-screen or in print, you need to delete it.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    07-13-2014
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2010
    Posts
    7

    Re: Hide/Show page within document.

    Hi Paul

    Thanks for taking the time to respond. Taking away from what you said then, would it still be possible, if not reliable, to hide the text of the second form and then choose only to display it if the ComboBox has content? If so, what code would I need to display hidden text and would that code also affect other hidden text on the document that I perhaps don't want to become visible?

    Cheers

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

    Re: Hide/Show page within document.

    If you were to insert a section break either side of the second form's content (or just one before it if nothing follows that form), you could use code like:
    ActiveDocument.Sections(2).Range.Font.Hidden = True
    where 2 is the Section #. The real issue then becomes one of controlling the 'Hidden' property. You could do that with code like:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-13-2014
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2010
    Posts
    7

    Re: Hide/Show page within document.

    Someone buy this man a beer, it works perfectly

    I can't thank you enough - that's shaved hours off my fruitless trial and error.

+ 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. [SOLVED] Having difficultly moving a section from page 3 to page 2 in a word document form
    By UNAB in forum Word Formatting & General
    Replies: 2
    Last Post: 03-25-2013, 07:52 AM
  2. Hide Column & Print page Macro printing blank page?!
    By Margate in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2013, 03:59 PM
  3. VBA hide row based on pull down with button to toggle show/hide
    By myronr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2012, 06:07 PM
  4. Using Section Page Numbers and Document Page Numbers In Footer
    By janschepens in forum Word Formatting & General
    Replies: 2
    Last Post: 03-16-2012, 01:54 PM
  5. [SOLVED] [SOLVED] How do I delete page 2 of a 2-page document?
    By Katie in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 06-14-2006, 12:00 PM

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