![]() |
|
|
|
#1
|
|||
|
|||
|
Hi
I Need to Find a Couple of TAG <S1>, <S2>, <S3>...etc. If find the tags in the document need to create a style as S1, S2, S3...etc. without losing format. If TAG not found, NO tags Found as a MSG is this possible. |
|
#2
|
||||
|
||||
|
Your description is rather vague. How is one supposed to know what the attributes of the Style might be?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
Hi
I have uploaded Input File and Style File. |
|
#4
|
||||
|
||||
|
For example:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "\<[! ]@\>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
.Execute
End With
If .Find.Found = False Then
MsgBox "No tags found", vbExclamation
End If
Do While .Find.Found = True
.Style = Split(Split(.Text, "<")(1), ">")(0)
.Text = vbNullString
.Find.Execute
Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Create text box in VBA and style content | dpashley | Word VBA | 2 | 08-01-2017 01:40 AM |
Modify or create a style
|
otuatail | Word | 3 | 09-12-2016 12:20 PM |
I create a new style but it fails to appear in Quick Style list
|
veronius | Word | 6 | 06-18-2013 06:29 PM |
How do I create a style that changes only the color???
|
wornways | Word | 1 | 12-21-2011 04:19 PM |
Help to find Style Set Office
|
Jazz43 | Office | 1 | 05-28-2011 02:39 AM |