![]() |
|
![]() |
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
![]()
I am unable to replicate the behaviour you say is occurring when I run the macros against your 'VBA Example' attachment. And just to make sure, I added:
ActiveDocument.Range.Font.Reset to the end of the first macro to strip out all character-level formatting (Paragraph Style formatting remains formatted as such). We don't have one; all help here is gratis.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]()
Well thats weird because I still have the problem (please see in the attached document: 1.1 is highlighted).
Could it be that I added "ActiveDocument.Range.Font.Reset" at the wrong place in the macro? My first macro now looks like this: Code:
Sub aaaaaQuelldok() ' hyphenation off ActiveDocument.AutoHyphenation = False 'tag all formatted words Application.ScreenUpdating = False With ActiveDocument.Range.Find .ClearFormatting .Replacement.ClearFormatting .Format = True .Forward = True .MatchWildcards = True .Wrap = wdFindContinue .Font.Underline = True .Text = "" .Replacement.Text = "<u>^&</u>" .Execute Replace:=wdReplaceAll .ClearFormatting .Highlight = True .Replacement.Text = "<h>^&</h>" .Execute Replace:=wdReplaceAll .ClearFormatting .Font.Bold = True .Replacement.Text = "<b>^&</b>" .Execute Replace:=wdReplaceAll .ClearFormatting .Font.Italic = True .Replacement.Text = "<i>^&</i>" .Execute Replace:=wdReplaceAll End With ActiveDocument.Range.Font.Reset Application.ScreenUpdating = True End Sub Code:
Sub aaaaaZieldok() Application.ScreenUpdating = False With ActiveDocument.Range.Find .ClearFormatting .Replacement.ClearFormatting .Format = True .Forward = True .MatchWildcards = True .Wrap = wdFindContinue .Replacement.Text = "\1" .Text = "\<u\>(*)\</u\>" .Replacement.Font.Underline = True .Execute Replace:=wdReplaceAll .Replacement.ClearFormatting .Text = "\<h\>(*)\</h\>" .Replacement.Highlight = True .Execute Replace:=wdReplaceAll .Replacement.ClearFormatting .Text = "\<b\>(*)\</b\>" .Replacement.Font.Bold = True .Execute Replace:=wdReplaceAll .Replacement.ClearFormatting .Text = "\<i\>(*)\</i\>" .Replacement.Font.Italic = True .Execute Replace:=wdReplaceAll End With Application.ScreenUpdating = True End Sub |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
redzan | Word VBA | 4 | 02-13-2016 12:24 PM |
![]() |
paik1002 | Word VBA | 4 | 12-07-2015 11:24 PM |
![]() |
kjxavier | Word | 1 | 01-02-2015 12:15 AM |
![]() |
rsrasc | Word VBA | 3 | 11-11-2014 03:55 PM |
![]() |
redzan | Word VBA | 1 | 07-27-2014 03:35 PM |