![]() |
#1
|
|||
|
|||
![]()
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 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. |
#2
|
||||
|
||||
![]()
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] |
#3
|
|||
|
|||
![]()
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.
|
#4
|
||||
|
||||
![]()
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] |
![]() |
Tags |
content control, macro vba word, word 2010 |
Thread Tools | |
Display Modes | |
|
![]() |
||||
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 |
![]() |
BrainSlugs83 | Word Tables | 8 | 11-14-2013 03:06 AM |
![]() |
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 |