Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-01-2014, 08:20 PM
Sharath_MS_Forums Sharath_MS_Forums is offline Checking Gender Windows 7 32bit Checking Gender Office 2007
Novice
Checking Gender
 
Join Date: Jul 2014
Location: India
Posts: 14
Sharath_MS_Forums is on a distinguished road
Default Checking Gender

Hi,

In a word document, I need to find all the occurrences of gender check (capital and small letters); male gender and female gender should be highlighted with different colors. I need 2 buttons, one for gender check and other to remove highlighting.


The following code suited my requirement to some extent
Code:
Sub GenderHighlight() 
    Dim r As Range 
    Dim MyList() As String 
    Dim i As Long 
     'MyList = Split("dot,com,like", ",")
    MyList = Split(" he , He , HE , him , Him , HIM , his , His , HIS , himself , Himself , HIMSELF , she , She , SHE , her , Her , HER , hers , Hers , HERS , herself , Herself , HERSELF ", ",") 
    For i = 0 To UBound(MyList()) 
        Set r = ActiveDocument.Range 
        With r.Find 
            .Text = MyList(i) 
            .Replacement.Highlight = wdYellow 
            .Execute Replace:=wdReplaceAll 
        End With 
    Next 
End Sub
Code:
Sub GenderHighlightRemove() 
    Dim r As Range 
    Dim MyList() As String 
    Dim i As Long 
     'MyList = Split("dot,com,like", ",")
    MyList = Split(" he , He , HE , him , Him , HIM , his , His , HIS , himself , Himself , HIMSELF , she , She , SHE , her , Her , HER , hers , Hers , HERS , herself , Herself , HERSELF ", ",") 
    For i = 0 To UBound(MyList()) 
        Set r = ActiveDocument.Range 
        With r.Find 
            .Text = MyList(i) 
            .Replacement.Highlight = wdWhite 
            .Execute Replace:=wdReplaceAll 
        End With 
    Next 
End Sub
Thanks in advance.
Sharath

Last edited by macropod; 07-02-2014 at 12:29 AM. Reason: Added code tags & formatting
Reply With Quote
 

Tags
gender check



Similar Threads
Thread Thread Starter Forum Replies Last Post
Turning On Spell Checking Again SQLUSA Word 9 08-01-2012 05:41 PM
Checking n cells above's content hanvyj Excel 4 03-22-2012 03:58 AM
Checking Gender Grammar checking isssue mahenn45 Word 1 03-01-2012 01:05 AM
Checking Gender Help with checking available times Deepy Excel 1 02-14-2011 05:06 PM
Checking for DOS executions ajetrumpet Excel 0 12-06-2009 02:33 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:09 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft