P
Prashanth KR
Hi,
I have a list of words in a doc say List.doc where I have listed a number of
words one below the other like:
Microsoft Word
SAP
E-business Suite
Salesforce.com
Iam currently using the below mentioned macro:
Sub Mymacro()
Dim sCheckDoc As String
Dim docRef As Document
Dim docCurrent As Document
Dim wrdRef As Object
sCheckDoc = "D:\List.doc"
Set docCurrent = Selection.Document
Set docRef = Documents.Open(sCheckDoc)
docCurrent.Activate
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Replacement.Font.Bold = True
.Replacement.Text = "^&"
.Forward = True
.Format = True
.MatchWholeWord = True
.MatchCase = False
.MatchWildcards = False
End With
For Each wrdRef In docRef.Words
If Asc(Left(wrdRef, 1)) > 32 Then
With Selection.Find
.Wrap = wdFindContinue
.Text = wrdRef
.Execute Replace:=wdReplaceAll
End With
End If
Next wrdRef
docRef.Close
docCurrent.Activate
End Sub
The problem here is that when I run this macro in another document having
these terms it does runs but BOLDS the letters "Microsoft", "Word", "E",
"Business", "Suite", "Salesforce" ".com" separately along with the full
letters i.e., Microsoft Word, E-business Suite, Salesforce.com.
I want only the full letters to be bolded. Kindly help me out in this.
Thanks,
Prashanth KR.
I have a list of words in a doc say List.doc where I have listed a number of
words one below the other like:
Microsoft Word
SAP
E-business Suite
Salesforce.com
Iam currently using the below mentioned macro:
Sub Mymacro()
Dim sCheckDoc As String
Dim docRef As Document
Dim docCurrent As Document
Dim wrdRef As Object
sCheckDoc = "D:\List.doc"
Set docCurrent = Selection.Document
Set docRef = Documents.Open(sCheckDoc)
docCurrent.Activate
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Replacement.Font.Bold = True
.Replacement.Text = "^&"
.Forward = True
.Format = True
.MatchWholeWord = True
.MatchCase = False
.MatchWildcards = False
End With
For Each wrdRef In docRef.Words
If Asc(Left(wrdRef, 1)) > 32 Then
With Selection.Find
.Wrap = wdFindContinue
.Text = wrdRef
.Execute Replace:=wdReplaceAll
End With
End If
Next wrdRef
docRef.Close
docCurrent.Activate
End Sub
The problem here is that when I run this macro in another document having
these terms it does runs but BOLDS the letters "Microsoft", "Word", "E",
"Business", "Suite", "Salesforce" ".com" separately along with the full
letters i.e., Microsoft Word, E-business Suite, Salesforce.com.
I want only the full letters to be bolded. Kindly help me out in this.
Thanks,
Prashanth KR.