View Single Post
 
Old 09-30-2014, 03:34 AM
JSC6 JSC6 is offline Windows 8 Office 2013
Novice
 
Join Date: Sep 2014
Posts: 1
JSC6 is on a distinguished road
Post Highlight Words from a Word List

Hi everyone!

I'm trying to create a macro for Microsoft Word 2013. However, it does not work.

Here is the code:
Code:
Sub CompareWordList() 
    Dim sCheckDoc As String 
    Dim docRef As Document 
    Dim docCurrent As Document 
    Dim wrdRef As Object 
    sCheckDoc = "C:\checklist.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 = True 
        .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
I would really like this to work for Word 2013. Could you guys help me?

I found it on the following link, where it says it works for 2007 and 2010 only: http://wordribbon.tips.net/T001173_H...Word_List.html

Last edited by macropod; 09-30-2014 at 08:20 PM. Reason: Added code tags & formatting
Reply With Quote