Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 06-23-2016, 03:30 AM
macropod's Avatar
macropod macropod is offline Don't Print Content Control Placeholder Text Windows 7 64bit Don't Print Content Control Placeholder Text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The simplest approach would be to insert a space character into the otherwise empty content controls. There is no need to modify the Placeholder Text.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 07-01-2016, 06:57 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

The problem with that, though, is that this document is filled out in different stages. The first stage involves filling out around 25 of these content controls which would mean the user would have to put a space in the other 75 content controls. Then, when they have to go back into the form and fill out the next 15-20, they won't see them. A lot of the users are not familiar with content controls so even if they did come across them, they would have no idea that they are supposed to fill them out if there's no placeholder text to tell them to do so.
Reply With Quote
  #4  
Old 07-01-2016, 01:57 PM
macropod's Avatar
macropod macropod is offline Don't Print Content Control Placeholder Text Windows 7 64bit Don't Print Content Control Placeholder Text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The idea was to use a print macro, such as those Greg Maxey describes to temporarily replace the placeholders with a space; not for anyone to do it manually. Have you tried contacting Greg Maxey via his website?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

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 03:57 AM.


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