Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-13-2013, 04:59 AM
jeffaus jeffaus is offline How to retrieve text from a word content control in VBA Windows Vista How to retrieve text from a word content control in VBA Office 2007
Novice
How to retrieve text from a word content control in VBA
 
Join Date: Mar 2013
Posts: 1
jeffaus is on a distinguished road
Default 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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to retrieve text from a word content control in VBA 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 to retrieve text from a word content control in VBA How do you set rich text in a content control Testor Word VBA 4 07-08-2012 07:55 AM
How to retrieve text from a word content control in VBA Rich Text Content Control - Allow User Formatting keithacochrane Word 1 05-28-2012 05:06 PM
How to retrieve text from a word content control in VBA 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

Other Forums: Access Forums

All times are GMT -7. The time now is 11:33 AM.


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