#1
|
|||
|
|||
How to retrieve text from a word content control in VBA
Hi All
I am new to VB and I'm having difficulty retrieving text from a content control Below is the code that i have come up with but it doesn't seem to work. When I use the {valuecc = "test"} line it works but when i try the line below it doesn't. Can anyone tell me where i'm going wrong? Thanks Jeffaus Code:
Private Sub Swapcc(doc As Document, tagcc As String) Dim cc As ContentControl Dim valuecc As String 'valuecc = "test" valuecc = ActiveDocument.ContentControlsbyTag(tagcc).Range.Text For Each cc In Documents(doc).ContentControls If cc.tag = tagcc Then cc.Range = valuecc End If Next End Sub Last edited by macropod; 03-14-2013 at 11:38 PM. Reason: Added code tags & formatting |
#2
|
||||
|
||||
Hi jeffaus,
There is no such thing in Word as a 'ContentControlsbyTag' method. What Word has is a SelectContentControlsByTag method.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Creating a plain text content control for every instance of a word or phrase | RobsterCraw | Word VBA | 16 | 11-20-2012 03:25 PM |
How do you set rich text in a content control | Testor | Word VBA | 4 | 07-08-2012 07:55 AM |
Rich Text Content Control - Allow User Formatting | keithacochrane | Word | 1 | 05-28-2012 05:06 PM |
content control Word 2007 | TessaLee | Word | 1 | 03-11-2011 12:51 AM |
Templates: automatic text generation from Rich Text content control | Chickenmunga | Word | 0 | 10-01-2008 11:16 AM |