![]() |
|
#10
|
|||
|
|||
|
Explanation: your code looks for chr(145) followed by any digit & any char but ^02 and then replaces these THREE chars with TWO chars, which are chr(146) & the digit, thus loosiing the third char.
Code:
Sub SingleBeforeDigit()
'Replace Chr(145) with Chr(146) before a digit (as in ’95)
Dim oRng As range
Set oRng = ActiveDocument.range
Options.AutoFormatAsYouTypeReplaceQuotes = False
With oRng.Find
.ClearFormatting
.text = Chr(145) & "([0-9][!^02])" 'to avoid footnote ref. marks
.Replacement.text = Chr(146) & "\1"
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
Options.AutoFormatAsYouTypeReplaceQuotes = True
End Sub
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Find/replace - remove a space in 4 digit numbers
|
lalywizz | Word | 5 | 10-08-2021 09:27 AM |
Trying to change the last digit in a column of 10 digit entries
|
arkansawyer16 | Excel | 10 | 04-06-2020 02:03 PM |
| Regex/wildcard search for dates with 2-digit and 4-digit years | Marrick13 | Word VBA | 2 | 01-29-2016 07:04 AM |
A challenging digit by digit manipulation, rotate the digit in range of 0 to 9
|
laucn | Excel Programming | 14 | 05-17-2015 12:12 PM |
Apostrophe-like mark appearing next to page numbers
|
Natalie | Word | 2 | 04-26-2012 05:17 AM |