Consulting

Results 1 to 3 of 3

Thread: Hiding Content Controls

  1. #1

    Hiding Content Controls

    So with some help already I have created these wonderful letter templates for use in my office. They each use a UserForm with various textboxes, checkboxes, dropdowns etc for the user to input the data. The template itself then has rich text content controls which populate with specified buildingblocks depending on which boxes have been checked, filled, selected etc from the Userform. I've created a special ribbon that allows my users (some of whom are not IT minded at all) to press a button and recall the Userform so that they can update the data if they realise they forgot something or additional items need to be included in the letter.

    The main problem that I have is that if, based on the initial filling out of the Userform, a particular content control (and its associated buildingblock) are not required, my code currently tells that content control to delete (so it works on a basis of either fill with building block A or B or delete because it's not needed). However, if the user then realises they do need that paragraph and recalls the Userform, the checkbox for this paragraph will no longer work (on hitting the apply command button) because the content control has now been deleted.

    My question then is, is there a way to hide my content controls rather than delete them so that they can still be used if we need to update the data input? I realise I could colour the font white etc but each content control takes up a line in the document so the formatting would look weird if I had a load of content controls (albeit with nothing actually visible) as it would appear that I have several blank lines. Any ideas?

  2. #2
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,063
    Location
    You could try setting your content control placeholder text to a zero width space:

    oCC.SetPlaceholderText , , ChrW(8203)
    Greg

    Visit my website: http://gregmaxey.com

  3. #3
    Or you could so have it working on a basis of either fill with building block A or B or fill with the zero space suggested by Greg.
    Or you could check that all the controls are in present when you call your userform and restore any that are missing before running the userform.
    Or check that the controls are present and if not block the re-editing function using the userform.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

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