View Single Post
 
Old 12-22-2012, 11:07 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,363
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi binar,

Quote:
something in the code is making it subtract an additional single UNDERLINE space that is not needed. In other words, the macro does a great job of not applying an UNDERLINE to the PERIOD character located at the end, but then it goes a step beyond and also subtracts an additional UNDERLINE space from the last letter character located to the left of the PERIOD. In short, it looks like the example below:

3.4 Heading 2 Example.
That suggests your heading Styles don't include the underlining and someone has applied that manually. That is a poor use of the Styles. Used correctly - with the underlining applied to the Style definitions, this would not occur. Ideally, you should get the Style deinitions right before running the macro.

Nevertheless, even without getting the Style definitions right you can work around the issue by inserting:
.Replacement.Font.Underline = True
before the first:
.Execute Replace:=wdReplaceAll

And, if you've already saved your work with the 'erroneous' underlining, you can redeem it by changing the first F/R expression to:
.Text = "([!.].)(^13)"
.Replacement.Text = "\1\2"
(with the addition of the '.Replacement.Font.Underline = True' line).

PS: Please don't automatically quote the entire post replied to each time you post. It's quite unnecessary and just clutters the thread. If there's a particular element of the post replied to that warrants quoting, then quote just that portion - as I have done in this reply.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote