Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-20-2012, 09:26 AM
RobsterCraw RobsterCraw is offline Creating a plain text content control for every instance of a word or phrase Windows 7 32bit Creating a plain text content control for every instance of a word or phrase Office 2010 32bit
Novice
Creating a plain text content control for every instance of a word or phrase
 
Join Date: Nov 2012
Posts: 11
RobsterCraw is on a distinguished road
Default


Ok an update... Again thank you to gmaxey for all his help.

I had to clear a few errors from the code but I still don't know how to fix the one error that keeps cropping up.
It has to do with the fact that if there are more than one CC in the document with the same title already, the following statements will only except the first, and then error on the second (or so it seems). How can I write the following exception differently so that it excludes all existing CCs?

HTML Code:
        If Not oRng.InRange(ActiveDocument.SelectContentControlsByTitle(oCCTitle).Item(1).Range) Then
            'The following line gives me a command failed error when there are more than one existing CCs
            'with the same title. Sometimes the error is
            Set oCC = ActiveDocument.ContentControls.Add(wdContentControlText, oRng)
            oCC.XMLMapping.SetMapping (ActiveDocument.SelectContentControlsByTitle(oCCTitle).Item(1).XMLMapping.xPath)
            oCC.Title = oCCTitle
            oRng.Collapse wdCollapseEnd
        End If
Reply With Quote
Reply

Tags
content control, find & replace, xml



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a plain text content control for every instance of a word or phrase Rich text/Plain text Content Controls in Template michael.fisher5 Word 9 11-19-2014 06:36 AM
Creating a plain text content control for every instance of a word or phrase How do you set rich text in a content control Testor Word VBA 4 07-08-2012 07:55 AM
Word2010 check boxes and plain text content control boxes in same table fcsungard Word 5 06-01-2012 01:16 AM
Creating a plain text content control for every instance of a word or phrase Rich Text Content Control - Allow User Formatting keithacochrane Word 1 05-28-2012 05:06 PM
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 04: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