View Single Post
 
Old 12-12-2012, 10:27 AM
dmarie123 dmarie123 is offline Windows 7 64bit Office 2007
Novice
 
Join Date: Dec 2012
Location: New Yuk
Posts: 23
dmarie123 is on a distinguished road
Default

I do like the deep end...hahaha! Thank you Greg for your help with this!!

I have a few questions (big shocker, I know )

1. The macro works for but it's only changing the first instance of "This student". When I first ran it it worked for every instance...
I get a Run-time error 4198? When I debug the following line is highlighted:
Set oCC = ActiveDocument.ContentControls.Add(wdContentContro lText, oRng)

I have other document properties in the word doc, I'm not sure if that's problematic, I wouldn't think so but see previous post about "in over my head"?

2. Can I add more parameters? Like this:
strFind() = Split("This student|student|STUDENT|this Student|This Student", "|") and then change the MatchCase to True?

3. I'm wondering if there is a Not statement I can tie in? In SQL you can basically say look for "student" but not "my student" and then when you find the correct one replace it with "Ann Smith". Is selective replacing possible w/ VBA? The word "student" appears in areas of general text and should not be changed to the proper name (that is now tied to the content control). Also, the word "students" appears randomly and I don't want that to change. I tried changing it from False to True for .MatchWholeWord but then it didn't recognize both terms...It's not specific areas or I would be asking for help with ranges haha.

Thank you in advance (again) for your help. I'm trying to figure these things out before I post. So far I just have a headache .

Last edited by dmarie123; 12-12-2012 at 12:03 PM.
Reply With Quote