?
Solved

How do I hide certain text until a Text Content Control box is Modified?

Posted on 2009-04-10
8
Medium Priority
?
676 Views
Last Modified: 2012-05-06
I am creating a customized form for printing labels.  I have 5 cells on the page.  On the bottom of each cell there is a Line of Text that I want to display for each label (footer for each cell).  However I would not like to waste a label should the Text controls are not used.  Is there any way to have conditions where if the Text Controls are not modified, their respective "footer" line is not displayed?
0
Comment
Question by:cgsolutions
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 19

Expert Comment

by:dlc110161
ID: 24138763
Could you post an example form for me to test with?

Thanks.

Dawn Bleuel
Word MVP
0
 

Author Comment

by:cgsolutions
ID: 24142266
Here you go... Thanks.
0
 

Author Comment

by:cgsolutions
ID: 24142757
I guess ee doesn't like dotx files...
sample.docx
0
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 
LVL 19

Expert Comment

by:dlc110161
ID: 24148877
Is there a reason you have 6 content controls per label? You can set it so that it allows multiple paragraphs.

Hiding the text would be much easier if two things are done. 1. Only one content control per label. 2. The text to be hidden is a unique style - preferably using the same prefix incremented with a number ie. Label1, Label2, etc.

Dawn Bleuel
Word MVP
0
 

Author Comment

by:cgsolutions
ID: 24148985
The reason I have 6 content controls is because I want to limit the amount of lines the user can have to 6 and also have the text in a specific position.  Would there be a way to have one content label while acheiving the same results?  Labeling the content controls is not a problem, they can be whatever name that will suit the needs for this.
0
 
LVL 19

Accepted Solution

by:
dlc110161 earned 2000 total points
ID: 24151489
I'll let you test this out. I've tested, but I'm not sure how you are going to use it, so you will need to execute the macro to test. At some point, I am sure that you will want to attach the code to some event such as the Print command.

Anyway, give it a whirl and let me know.

If you need help installing the macro, see http://word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm

Dawn Bleuel
Word MVP
Sub HideCell()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
Dim cc As ContentControl
Dim oRowe As Integer
Dim i As Integer
On Error GoTo EH
 
Selection.HomeKey Unit:=wdStory
With Selection
    If .Information(wdWithInTable) Then
        oRowe = .Information(wdEndOfRangeRowNumber)
        For Each cc In ActiveDocument.ContentControls
            If cc.Range.Text <> cc.PlaceholderText Then
                rDcm.Tables(1).Rows(oRowe).Select
                i = i + 1
                Debug.Print oRowe
            Else
                rDcm.Tables(1).Rows(oRowe).Select
                Debug.Print oRowe
                If i = 1 Then .Font.Hidden = True
                i = i + 1 'Increment cc
                    If i = 6 Then
                        i = 1 'Reset cc
                        oRowe = oRowe + 1
                    End If
            End If
        Next
        oRowe = oRowe + 1
    End If
End With
 
'Handle Errors Gracefully
Exit_EH:
    Exit Sub
 
EH:
    Select Case Err.Number
        Case 5941
            Resume Exit_EH
        Case Else
            MsgBox Err.Number & ": " & Err.Description
            Resume Exit_EH
    End Select
 
End Sub

Open in new window

0
 

Author Comment

by:cgsolutions
ID: 25117039
Thanks will try it out.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question