![]() |
|
#19
|
|||
|
|||
|
Thanks very much, that worked a treat,
now I'm having problems with the second part Code:
Sub FindTemplateToPage()
Dim aRng As Range, str As String, int1 As Integer, int2 As Integer, arrStr() As String
Set aRng = ActiveDocument.Range
With aRng.Find
.ClearFormatting
.MatchWildcards = True
.Text = "-[0-9]{1,3}"
Do While .Execute = True
int1 = CInt(Replace(aRng.Text, "-", ""))
If int1 > 7 And int1 < 10 Then
int1 = int1 - 8
Else
int1 = int1 + 2
End If
aRng.Text = "-" & int1
aRng.Collapse Direction:=wdCollapseEnd
aRng.End = ActiveDocument.Range.End
Loop
End With
End Sub
Code:
.Text = "-[0-9]{1,3}"
Code:
Do While .Execute = True Any ideas? Thanks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Replace characters in a string
|
Marcia | Excel Programming | 5 | 05-04-2020 05:15 AM |
Wildcard replace any string in context with a specified string
|
wardw | Word | 7 | 05-07-2018 09:13 AM |
Replace multiple strings by one same string at once
|
puff | Word | 2 | 02-28-2018 11:04 AM |
Replace characters in a string
|
Anthon | Excel Programming | 1 | 11-03-2016 12:48 AM |
| How to do multiple find and replace in string. | PRA007 | Word VBA | 2 | 01-06-2016 09:10 PM |