![]() |
|
#1
|
||||
|
||||
![]()
Try:
Code:
Sub GenderHilite() Dim Rslt Rslt = InputBox("Choose an option:" & vbCr & "1. Hilight Male" & vbCr & "2. Hilight Female" _ & vbCr & "3. Un-Hilight Male" & vbCr & "4. Un-Hilight Female") Select Case Trim(Rslt) Case "": Exit Sub Case 1: Call HighlightToggle(0, wdTurquoise) Case 2: Call HighlightToggle(1, wdPink) Case 3: Call HighlightToggle(0, wdNoHighlight) Case 4: Call HighlightToggle(1, wdNoHighlight) End Select End Sub Sub HighlightToggle(Gender As Long, Hilite As Long) Dim i As Long, StrGen As String StrGen = "<[Hh][Ee]> <[Hh][Ii][MmSs]> <[Hh][Ii][Mm][Ss][Ee][Ll][Ff]>|" & _ "<[Ss][Hh][Ee]> <[Hh][Ee][Rr]> <[Hh][Ee][Rr][Ss]> <[Hh][Ee][Rr][Ss][Ee][Ll][Ff]>" StrGen = Split(StrGen, "|")(Gender) Options.DefaultHighlightColorIndex = Hilite With ActiveDocument.Range.Find .ClearFormatting .Replacement.ClearFormatting .Format = True .Forward = True .Wrap = wdFindContinue .MatchWildcards = True .Replacement.Highlight = True For i = 0 To UBound(Split(StrGen, " ")) .Text = Split(StrGen, " ")(i) .Execute Replace:=wdReplaceAll Next End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]()
Thanks a lot for the code
Actually, the situation is while transcribing a medical document, in history of the patient, it starts with like "A 24-year-old male/female patient...." and the rest of document goes with words like he/she, him/her, himself/herself like that...so the task here is to find any wrong occurrences (like if the patient is a male, she/herself like words which are highlighted can be deleted) to avoid gender errors in the document and to increase accuracy of the medical document. Your above code suffices the task appropriately. Instead of ourselves finding out male or female, the code should find the word male or female and rest of the gender-related words. So, could you please add 1 button or a shortcut key for checking "male or all she/he related occurrences" and other one to remove the highlight....these words when highlighted, gender errors are easily identified and in turn help us to avoid gender errors. Thanks in advance. Sharath Last edited by Sharath_MS_Forums; 07-06-2014 at 06:07 AM. Reason: Grammar |
![]() |
Tags |
gender check |
|
![]() |
||||
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 |
![]() |
mahenn45 | Word | 1 | 03-01-2012 01:05 AM |
![]() |
Deepy | Excel | 1 | 02-14-2011 05:06 PM |
Checking for DOS executions | ajetrumpet | Excel | 0 | 12-06-2009 02:33 PM |