#16
|
||||
|
||||
To combine them you could use: Code:
Sub Demo() Application.ScreenUpdating = False Dim RngSel As Range, RngTmp As Range, i As Long, j As Long With Selection Set RngSel = .Range With .Range With .Find .ClearFormatting .Replacement.Text = "\1" .Format = False .Forward = True .Wrap = wdFindContinue .MatchWildcards = True .Replacement.ClearFormatting .Text = "\[b\](*)\[/b\]" .Replacement.Font.Bold = True .Execute Replace:=wdReplaceAll .Replacement.ClearFormatting .Text = "\[i\](*)\[/i\]" .Replacement.Font.Italic = True .Execute Replace:=wdReplaceAll .Replacement.ClearFormatting .Text = "\[u\](*)\[/u\]" .Replacement.Font.Underline = True .Execute Replace:=wdReplaceAll .Replacement.ClearFormatting .Text = "\[color=0040FF\](*)\[/color\]" .Replacement.Font.ColorIndex = &HFF0400 .Execute Replace:=wdReplaceAll .Wrap = wdFindStop .Text = "\[list=[0-9]\]*\[/list\]" .Replacement.ClearFormatting .Replacement.Text = "" .Execute End With Do While .Find.Found If .InRange(RngSel) = False Then Exit Do i = CLng(Split(Split(.Text, "]")(0), "=")(1)) - 1 j = 0 Set RngTmp = .Duplicate With .Duplicate .Paragraphs.First.Range.Text = vbNullString .Paragraphs.Last.Range.Text = vbNullString With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "\[\*\]" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .Execute End With Do While .Find.Found j = j + 1 If .InRange(RngTmp) = False Then Exit Do .Text = i + j & ". " .Collapse wdCollapseEnd .Find.Execute Loop End With .Collapse wdCollapseEnd .Find.Execute Loop End With End With RngSel.Select Set RngSel = Nothing: Set RngTmp = Nothing Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#17
|
|||
|
|||
I suppose I am not really worried about getting exactly the same size so as long as it is bigger or smaller it would work.
I have added my colour alterations to your demo macro and added HTML Code:
.Replacement.ClearFormatting .Text = "\[size=150\](*)\[/size\]" .Replacement.Font.Size = 16 .Execute Replace:=wdReplaceAll Thank you so much for your help. Bob. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
APA format without cover page or references? | SoMany | Word | 0 | 03-02-2018 10:36 AM |
Running Head AND Page Number on First Page of Document (for APA Format) with Word 2003 | DBinSJ | Word | 3 | 11-23-2016 11:52 AM |
word page format | bakhtawar12 | Word | 1 | 01-22-2015 07:08 PM |
Changing page format in document by page | fiedlerw01 | Word | 1 | 10-23-2012 04:10 AM |
Web page format | Microsoftenquirer1000 | Word | 1 | 10-13-2012 06:38 AM |