![]() |
|
#12
|
||||
|
||||
|
Hi Paul,
thank you , I reset the 2016, however , I had an epiphany and oops, it had to be me that let down the mission to mars. I found the problem - embarrassingly the reason I had errors, is because I had the styles - that didn't exist - I forgot - that Character Style 1 and 2 were placeholders yikesss! ![]() As you can see hopelessly useless when it comes to VBA, I spent hours fiddling about yesterday. So both macros A+++++ working perfectly as is, I ran them on a folder full of docs - no problemo. Now the last problem I have - I will have to ask for your help again - otherwise I will be stuck from here to 2016. If I simply want to find the styles and insert the placeholders, which lines do I adapt? All the #signs have been removed as they served their purpose and have to be deleted from the documents. I simply want to find the styles and insert placeholders before and after each style Code:
StrStyFind = "Strong,Heading 1"
StrRep = "Placeholder1 ^& Placeholder2 ,Placeholder3 ^& Placeholder4>"
With ActiveDocument.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Format = True
.Wrap = wdFindContinue
.MatchWildcards = True
For i = 0 To UBound(Split(StrFnd, ","))
.Text = Split(StrFnd, ",")(i) ' Stuck here
.Replacement.Style = Split(StrSty, ",")(i) 'Stuck here
.Replacement.Text = Split(StrRep, ",")(i)
.Execute Replace:=wdReplaceAll
Next
thank you ![]() J |
| Tags |
| apply style, case |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Apply styles in word table | 1van | Word VBA | 2 | 11-17-2015 11:05 AM |
VBA Word - Format ALL Tables - Apply Specific Formatting to Sets of Columns – Font, Border & Width
|
jc491 | Word VBA | 10 | 11-04-2015 04:02 PM |
| Question about Case statement | Jennifer Murphy | Word VBA | 1 | 01-05-2013 02:30 PM |
| Paragraph space before - can styles apply it intelligently? | timpani | Word | 7 | 10-23-2012 04:08 PM |
| FInd recurring words in Word 2003 | NJ007 | Word | 4 | 01-25-2010 03:11 PM |