Janine
11-06-2010, 03:40 AM
Hi, :hi:
Moving this macro to Word 2010 template and I am getting the below error:-
sArr = split("Clause^w") ' your list ***2010 Error: Compile Error Ambiguous Name Detected
Any ideas please - thank you.
Sub HighlightListWords1()
'Clause 10 and clauses 15 and 22, Clause 22
' ***
' I have a list of 25 words... can I click a button and have Word
' highlight wherever those words appear?
Dim sArr() As String
Dim rTmp As Range
Dim x As Long
sArr = split("Clause^w") ' your list ***2010 Error: Compile Error Ambiguous Name Detected
Options.DefaultHighlightColorIndex = wdYellow
For x = 0 To UBound(sArr)
Set rTmp = ActiveDocument.Range
With rTmp.Find
.text = sArr(x)
.Replacement.text = sArr(x)
.Replacement.Highlight = True
.Replacement.Font.Bold = True
.Replacement.text = "Clause^s"
.Execute Replace:=wdReplaceAll
End With
Next
End Sub
With Selection
.Find.Execute findText:="assessment and plan:", Forward:=False, Wrap:=wdFindStop, MatchCase:=False
If .Find.Found Then
.InsertAfter vbCr & "1." & Chr(32) & Chr(32)
.Start = .End
.End = .Start
End If
End With
End Sub
Moving this macro to Word 2010 template and I am getting the below error:-
sArr = split("Clause^w") ' your list ***2010 Error: Compile Error Ambiguous Name Detected
Any ideas please - thank you.
Sub HighlightListWords1()
'Clause 10 and clauses 15 and 22, Clause 22
' ***
' I have a list of 25 words... can I click a button and have Word
' highlight wherever those words appear?
Dim sArr() As String
Dim rTmp As Range
Dim x As Long
sArr = split("Clause^w") ' your list ***2010 Error: Compile Error Ambiguous Name Detected
Options.DefaultHighlightColorIndex = wdYellow
For x = 0 To UBound(sArr)
Set rTmp = ActiveDocument.Range
With rTmp.Find
.text = sArr(x)
.Replacement.text = sArr(x)
.Replacement.Highlight = True
.Replacement.Font.Bold = True
.Replacement.text = "Clause^s"
.Execute Replace:=wdReplaceAll
End With
Next
End Sub
With Selection
.Find.Execute findText:="assessment and plan:", Forward:=False, Wrap:=wdFindStop, MatchCase:=False
If .Find.Found Then
.InsertAfter vbCr & "1." & Chr(32) & Chr(32)
.Start = .End
.End = .Start
End If
End With
End Sub