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.