Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-22-2016, 11:21 AM
vera vera is offline Don't Print Content Control Placeholder Text Windows 7 64bit Don't Print Content Control Placeholder Text Office 2010 64bit
Novice
Don't Print Content Control Placeholder Text
 
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
 

Tags
content control, macro vba word, word 2010



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set the Content Control placeholder default text dsimon14 Word VBA 3 03-27-2015 07:15 AM
Is there VBA to paste text into content control? kintap Word VBA 2 07-02-2014 07:42 AM
Don't Print Content Control Placeholder Text Deleting a table from a content control -- preserving the content control BrainSlugs83 Word Tables 8 11-14-2013 03:06 AM
Don't Print Content Control Placeholder Text How do you set rich text in a content control Testor Word VBA 4 07-08-2012 07:55 AM
Templates: automatic text generation from Rich Text content control Chickenmunga Word 0 10-01-2008 11:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:18 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft