View Single Post
 
Old 06-22-2016, 11:21 AM
vera vera is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Feb 2016
Posts: 5
vera is on a distinguished road
Default Don't Print Content Control Placeholder Text

I have a form with a few macros that I'm using. Not all of the areas are filled out every time the form is used, so I wanted to add some additional macros to help hide the placeholder text when printing only. I used the Method II code from Greg Maxey (http://gregmaxey.com/word_tip_pages/...print_pht.html) but when I used it, I received an error. My knowledge of macros is very limited so I have no idea what I'm supposed to do fix it. I get a run-time error '91' when printing and am brought to the following area of code in the standard module when I select "Debug": (specifically "arrPHT(i) = oCC.PlaceholderText" under Case 2)

Code:
 
Function Processor(ByRef lngAction As Long) As CCCollection
  Dim oCount As Long
  i = 0
  lngValidator = ActiveDocument.Sections(1).Headers(1).Range.StoryType
  For Each oRngStory In ActiveDocument.StoryRanges
    'Iterate through all linked stories
    Select Case oRngStory.StoryType
      Case 1 To 11
        Do
          For Each oCC In oRngStory.ContentControls
            Select Case lngAction
              Case 1
                oCount = oCount + 1
              Case 2
                oCount = oCount + 1
                'Store placeholder text
                arrPHT(i) = oCC.PlaceholderText
                'Set temporary placeholder text
                oCC.SetPlaceholderText , , ChrW(8203)
                i = i + 1
              Case 3
               If oCC.ShowingPlaceholderText Then
                 'Restore stored placeholder text
                 oCC.SetPlaceholderText , , arrPHT(i)
               End If
               i = i + 1
            End Select
When I exit out of the VBE, it prints with only the first 5 content controls blank (~100 rich/plain text content controls total with ~20 check boxes) and leaves those 5 blank when I go back in the document itself. The only thing I changed was the delay in the class module from 00:00:05 to 00:00:15.

The other macros I used are very long (I don't know how to simplify what I have) so I did not include them here. If that is something I should be adding, I will do so if requested. Alternatively, I can adjust upload an abbreviated version of the document I am using.

Any help would be greatly appreciated.
Reply With Quote