![]() |
#1
|
|||
|
|||
![]()
Need to create style with in e.g: (<H1>, <H2>, <H3>... etc...)
and for character style need create bold as cBold italic as cItalic ...etc. In all stories. |
#2
|
||||
|
||||
![]()
This should get you started
Code:
Sub StyleItUp() Dim aRng As Range Set aRng = ActiveDocument.Range With aRng.Find .ClearFormatting .Replacement.ClearFormatting .Text = "<CN>" .Replacement.Style = "Heading 1" .Execute Replace:=wdReplaceAll .Text = "<CT>" .Replacement.Style = "Heading 2" .Execute Replace:=wdReplaceAll .Text = "<TX>" .Replacement.Style = "Body Text" .Execute Replace:=wdReplaceAll 'repeat above pattern for all paragraph styles 'now search for font attributes and apply character styles .Text = "" .Font.Bold = True .Replacement.ClearFormatting .Replacement.Style = "Strong" .Execute Replace:=wdReplaceAll .ClearFormatting .Font.Italic = True .Replacement.ClearFormatting .Replacement.Style = "Emphasis" .Execute Replace:=wdReplaceAll End With End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
stky | Word VBA | 3 | 04-23-2021 10:51 PM |
Create text box in VBA and style content | dpashley | Word VBA | 2 | 08-01-2017 01:40 AM |
![]() |
otuatail | Word | 3 | 09-12-2016 12:20 PM |
![]() |
veronius | Word | 6 | 06-18-2013 06:29 PM |
![]() |
wornways | Word | 1 | 12-21-2011 04:19 PM |