A community of 30,000 US Transcriptionist serving Medical Transcription Industry
I'm attempting to create a generic overall macro for my VR editing that includes multiple corrections, two of which are g and L to grams and liters (account preference for single-letter measurement designations, and hey, more characters for me). However, when I try to do this via Find and Replace function in Word, even when supposedly adding a space before and after the g and L, I end up with those characters being replaced in any word that begins with either of them (i.e., 1 g gentamicin = 1 gram gramentamicin, Lasix = litersasix). The preceding space before g or L is recognized, but the space after isn't.
I searched for special characters to make a nonbreaking space (actually probably not a good idea with my platform) or "any character" or "any letter" (^? and ^$), but my Word 2003 won't recognize them during the Replace function and gives me an error of "is not a valid special character for the Replace With box."
There's got to be a simpler way to do what I want to do than inputting replacements for every letter of the alphabet ( g a= grams a, g b= grams b, etc.). Hopefully?
I was hoping to make a macro that took care of every instance of them without my having to Autocorrect them individually as I go, and it's working great for about 20 other generic Find/Replace corrections I've put in it (why correct the same thing over and over and over, since VR never really learns?). It's just this one-letter deal that's throwing me.
I thought I actually just figured out that I can use ^? as a character to search for the space (i.e., put it right up next to g in the Find box as g^?, not g ^? as I was trying to do), but that's not really working consistently either, darn it. Though I think I'm getting closer to my solution. Any help/ideas still greatly appreciated.
The indenting obviously got lost with plain text in the post above originally, though it showed fine on my screen before posting.
Sub general_macro()
'
' general_macro Macro
' Macro recorded 9/18/2013 by word dummy
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Operating Room"
.Replacement.Text = "operating room"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "Recovery Room"
.Replacement.Text = "recovery room"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "room, placed "
.Replacement.Text = "room and placed"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "-mm"
.Replacement.Text = " mm"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "-cm"
.Replacement.Text = " cm"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " degree"
.Replacement.Text = "-degree"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "arouseable"
.Replacement.Text = "arousable"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "wretching"
.Replacement.Text = "retching"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " including"
.Replacement.Text = ", including"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ",, including"
.Replacement.Text = ", including"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " as well as"
.Replacement.Text = ", as well as"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ",, as well as"
.Replacement.Text = ", as well as"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " without"
.Replacement.Text = ", without"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ",, without"
.Replacement.Text = ", without"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " which"
.Replacement.Text = ", which"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ",, which"
.Replacement.Text = ", which"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " followed"
.Replacement.Text = ", followed"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ",, followed"
.Replacement.Text = ", followed"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " as described"
.Replacement.Text = ", as described"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " as noted"
.Replacement.Text = ", as noted"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " as mentioned"
.Replacement.Text = ", as mentioned"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " where"
.Replacement.Text = ", where"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "H&H"
.Replacement.Text = "H and H"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "I&D"
.Replacement.Text = "I and D"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "nontoxic appearing"
.Replacement.Text = "nontoxic-appearing"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "well appearing"
.Replacement.Text = "well-appearing"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "M.D."
.Replacement.Text = "MD"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "TPA"
.Replacement.Text = "alteplase"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "TNK"
.Replacement.Text = "tenecteplase"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " percent"
.Replacement.Text = "%"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "CK-MB%"
.Replacement.Text = "CK-MB percent"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "speech, swallowing difficulty"
.Replacement.Text = "speech or swallowing difficulty"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^pOPERATION:"
.Replacement.Text = "^pNAME OF OPERATION:"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^pOPERATIONS:"
.Replacement.Text = "^pNAME OF OPERATIONS:"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^pPROCEDURE:"
.Replacement.Text = "^pNAME OF PROCEDURE:"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^pPROCEDURES:"
.Replacement.Text = "^pNAME OF PROCEDURES:"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.ClearFormatting
With Selection.Find
.Text = "PHYSICAL EXAMINATION:"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.EndKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Application.Run MacroName:="Normal.NewMacros.stacked_to_paragraph"
Application.Run MacroName:="Normal.NewMacros.stacked_to_paragraph"
Application.Run MacroName:="Normal.NewMacros.stacked_to_paragraph"
Application.Run MacroName:="Normal.NewMacros.stacked_to_paragraph"
Application.Run MacroName:="Normal.NewMacros.stacked_to_paragraph"
Application.Run MacroName:="Normal.NewMacros.stacked_to_paragraph"
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.MoveUp Unit:=wdLine, Count:=3
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdStory
End Sub
OK, this is not pretty, very repetitive but word 2003 would not behave itself. And those of you who just cannot help but, reflexively, criticize: Yes, I know it is long and it is redundant but it would not work consistently, otherwise. If you do a web search, you will find I am not the only one who has encountered this glitch, unfortunately no one has posted a solution. So this is just the way I solved this problem so that this macro will work as expected.
Macro Undummy, I may not have perfectly understood what you wanted, and this macro just deals with changing g to gram(s) and L to liter(s). If this is what you need, then we can have your macro call this macro, otherwise I can change it.
Sub GramLiter()
'Macro created 9/18/2013 by WordExpress
Dim SrchStr, RpStr, Chr: Dim Plu As Boolean
Application.ScreenUpdating = False
Gram:
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1"
SrchStr = " g": RpStr = "gram"
With Selection.Find
.Forward = True
.ClearFormatting
.MatchWholeWord = True
.MatchCase = True
.Wrap = wdFindContinue
.Execute FindText:=SrchStr
End With
GoSub Ding
Do While Selection.Find.Found = True
With Selection.Find
.Forward = True
.ClearFormatting
.MatchWholeWord = True
.MatchCase = True
.Wrap = wdFindContinue
.Execute FindText:=SrchStr
End With
GoSub Ding
Loop
Liter:
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1"
SrchStr = " L": RpStr = "liter"
With Selection.Find
.Forward = True
.ClearFormatting
.MatchWholeWord = True
.MatchCase = True
.Wrap = wdFindContinue
.Execute FindText:=SrchStr
End With
GoSub Ding
Do While Selection.Find.Found = True
With Selection.Find
.Forward = True
.ClearFormatting
.MatchWholeWord = True
.MatchCase = True
.Wrap = wdFindContinue
.Execute FindText:=SrchStr
End With
GoSub Ding
Loop
Call Repairs
Application.ScreenRefresh
Application.ScreenUpdating = True
Exit Sub
Ding:
Plu = False
Selection.Collapse direction:=wdCollapseEnd
Chr = Selection.Text
Selection.TypeBackspace
Selection.TypeText "*"
If Chr = "." Or Chr = " " Or Chr = "," Then GoSub Oops: Return
Selection.TypeText Trim(SrchStr): Return
Oops:
Selection.MoveLeft unit:=wdWord, Count:=2: Chr = Selection.Text
If Chr <> 1 Then Plu = True
Selection.MoveRight Count:=3: Selection.TypeText RpStr:
If Plu = True Then
Selection.TypeText "s":
End If
Return
End Sub
Private Sub Repairs()
Application.ScreenUpdating = False
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1"
With Selection.Find
.ClearFormatting
.Text = "*"
.Replacement.ClearFormatting
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1"
With Selection.Find
.ClearFormatting
.Text = "gragramsm"
.Replacement.ClearFormatting
.Replacement.Text = "grams"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1"
With Selection.Find
.ClearFormatting
.Text = "gragrams"
.Replacement.ClearFormatting
.Replacement.Text = "gram"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1"
With Selection.Find
.ClearFormatting
.Text = "litliterser"
.Replacement.ClearFormatting
.Replacement.Text = "liters"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1"
With Selection.Find
.ClearFormatting
.Text = "litliterse"
.Replacement.ClearFormatting
.Replacement.Text = "liter"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With
End Sub
Provide you feedback, that is.
I personally obviously think there is a great need for macro help, but my guesstimation is (and not meaning this in an insulting way) that many MTs are just not tech-savvy enough to know what they're missing by not using more macros and automated set-ups (hotkeys, etc.) for their work, as well as being intimidated by the overall idea, unfortunately, and thus I doubt there is much of an actual market for such a service yet. I think many would simply not have any idea just how incredibly much help something like what you're proposing would really be in practice.
If you need anybody to supply a blurb/review/testimony to help elucidate that, though, you've definitely got one coming from me. Or if you just need a beta tester for some ideas. My platform is EditScript, by the way (Word-based, of course), which certainly very many are using (mainly used at Nuance, one of the "big 2," as you probably know, though I no longer work there but at another company that uses ES as well).
[edited to add] Oh, I forgot some of your other questions. The PE is the main one that is an issue. The ROS is seldom more than a couple of sections and really usually just narrative form, but the same function that was used for the PE could be helpful for the few times a longer, stacked ROS occurs (and should be set up exactly the same way as the PE, paragraphed subheadings started on the line underneath the heading). Could I just copy FixPX and make it a new macro to call in with REVIEW OF SYSTEMS: substituted for PHYSICAL EXAMINATION: ?
No bolding, ever.
I discovered you had several different codes for a paragraph mark in your sample (Ascii 11, 12, and 13), so I had to write this macro a little differently, rather than a simple search and replace. I did write a routine in to make sure there were 2 spaces inserted a hard return was taken out. It will be quite easy to change it to one space if that is what your account requires.
Sub FixPX()
' Macro created 9/19/2013 by WordExpress Transcriptions
Dim A, Tstr
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1"
With Selection.Find
.ClearFormatting: .Text = "PHYSICAL EXAMINATION:": .Execute Forward:=True
End With
With Selection
.Collapse: .MoveDown Unit:=wdLine: .HomeKey Unit:=wdLine
End With
GoSub Step1
Routine: While A > 13: GoSub Step1: Wend
GoTo DeletePara: Exit Sub
DeletePara:
Selection.Delete: GoSub Step2
If A = 11 Or A = 12 Or A = 13 Then ActiveDocument.Undo: Exit Sub
GoSub Space: GoTo Routine
Space: Selection.MoveLeft Unit:=wdWord, Extend:=wdExtend: Tstr = Selection.Text:
With Selection
.Delete: .TypeText Trim(Tstr) & " "
End With
GoSub Step2
While A = 32: Selection.Delete: GoSub Step2: Wend: Return
Step1: Selection.MoveRight Unit:=wdWord, Count:=1
Step2: A = Asc(Selection.Text): Return
End Sub
Got called in to do some work on my night off, so have had a chance to use the updated macro tonight already.
On my first report, a couple of the PE subheadings were like this after running it:
NECK: Supple.C HEST: Clear.H EART: Regular.A BDOMEN: Soft.
(That's 2 spaces between C and HEST, e.g.)
On my second report so far, just one subheading did that. (A BDOMEN:)
[edit] After paying more attention to original formatting, I see now it's just affecting the subheadings where the original ^p breaks were (see screenshots in post below). I wonder if it's related to the ASCII code? (which, again, I think was maybe just a result of copying & pasting to and then modifying the paragraphs while on this board?)
Also, my delete_double_commas macro* that I'm calling in with my general_macro isn't working, darn it. For example, when there already happens to be a comma before "which" in the report before I run my macro that then gets doubled because of my replace which to , which entry, it's still doubled. (,, which)
Again, things seem to work a little differently with my macros once I'm in EditScript as opposed to when I just test on examples in Word by itself.
*
Sub delete_double_commas()
'
' delete_double_commas Macro
' Macro recorded 9/19/2013 by word student
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ",, "
.Replacement.Text = ", "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey unit:=wdStory
End Sub
~~~~~~~~~~~~~~~~~~~~~
general_macro again:
Sub general_macro()
'
' general_macro Macro
' Macro recorded 9/18/2013 by word student
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Operating Room"
.Replacement.Text = "operating room"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "Recovery Room"
.Replacement.Text = "recovery room"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "room, placed "
.Replacement.Text = "room and placed"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "-mm"
.Replacement.Text = " mm"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "-cm"
.Replacement.Text = " cm"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " degree"
.Replacement.Text = "-degree"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "arouseable"
.Replacement.Text = "arousable"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "wretching"
.Replacement.Text = "retching"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " including"
.Replacement.Text = ", including"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " as well as"
.Replacement.Text = ", as well as"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " without"
.Replacement.Text = ", without"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " which"
.Replacement.Text = ", which"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " followed"
.Replacement.Text = ", followed"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " as described"
.Replacement.Text = ", as described"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " as noted"
.Replacement.Text = ", as noted"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " as mentioned"
.Replacement.Text = ", as mentioned"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " where"
.Replacement.Text = ", where"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "H&H"
.Replacement.Text = "H and H"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "I&D"
.Replacement.Text = "I and D"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "nontoxic appearing"
.Replacement.Text = "nontoxic-appearing"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "well appearing"
.Replacement.Text = "well-appearing"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "M.D."
.Replacement.Text = "MD"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "TPA"
.Replacement.Text = "alteplase"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "TNK"
.Replacement.Text = "tenecteplase"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "DSS"
.Replacement.Text = "docusate sodium"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " percent"
.Replacement.Text = "%"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "CK-MB%"
.Replacement.Text = "CK-MB percent"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "speech, swallowing difficulty"
.Replacement.Text = "speech or swallowing difficulty"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^pOPERATION:"
.Replacement.Text = "^pNAME OF OPERATION:"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^pOPERATIONS:"
.Replacement.Text = "^pNAME OF OPERATIONS:"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^pPROCEDURE:"
.Replacement.Text = "^pNAME OF PROCEDURE:"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^pPROCEDURES:"
.Replacement.Text = "^pNAME OF PROCEDURES:"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Call GramLiter
Call delete_double_commas
Call FixPX
Selection.HomeKey Unit:=wdStory
End Sub
Maybe this will help with the diagnosis. Totally before any editing, first version the original, second is after applying general_macro with FixPX. (I don't know how to get the formatting to show here, so I took screenshots after turning Formatting Marks on.)
#1:
#2 (affecting HEENT, NECK, LUNGS, and NEUROLOGIC, all the subheadings that had a preceding paragraph break):
Maybe this will prevent the problem, if it does not all I can do is write in a stop to the macro so it will halt after the first time it makes the error so there is only one edit to do. I just can't figure out why it is doing this.
Sub FixPX()
' Macro revised 9/20/2013 by WordExpress Transcriptions
Dim A
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1"
With Selection.Find
.ClearFormatting: .Text = "PHYSICAL EXAMINATION:": .Execute Forward:=True
End With
With Selection
.Collapse: .MoveDown Unit:=wdLine: .HomeKey Unit:=wdLine
End With
GoSub Step1
Routine: While A > 13: GoSub Step1: Wend
GoTo DeletePara: Exit Sub
DeletePara:
Selection.Delete: GoSub Step2
If A = 11 Or A = 12 Or A = 13 Then ActiveDocument.Undo: Exit Sub
GoSub Space: GoTo Routine
Space:
Selection.MoveStartUntil Cset:=".", Count:=wdBackward
Selection.TypeText " ": GoSub Step2
While A = 32: Selection.Delete: GoSub Step2: Wend: Return
Step1: Selection.MoveRight Unit:=wdWord, Count:=1
Step2: A = Asc(Selection.Text): Return
End Sub
Given how badly search/replace is working in 2003 for some reason (maybe some conflict with something else?) this may need more work. I have shortened it considerably, and made it easier for you to edit to add text to search and replace:
Sub General_Macro()
'Macro recorded 9/18/2013 by Word Student
'Updated 9/20/2013 by WordExpress Transcriptions
Dim SrString RpString
Call GramLiter
Call FixPX
Application.ScreenUpdating = False
GoSub Page1
SrString = "Operating Room": RpString = "operating room": GoSub FindIt
SrString = "Recovery Room": RpString = "recovery room": GoSub FindIt
SrString = "^pPROCEDURES:": RpString = "^pNAME OF PROCEDURES:": GoSub FindIt
SrString = "room, placed ": RpString = "room and placed": GoSub FindIt
SrString = "-mm": RpString = " mm": GoSub FindIt
SrString = "-cm": RpString = " cm": GoSub FindIt
SrString = " degree": RpString = "-degree": GoSub FindIt
SrString = "arouseable": RpString = "arousable": GoSub FindIt
SrString = "wretching": RpString = "retching": GoSub FindIt
SrString = " including": RpString = ", including": GoSub FindIt
SrString = " as well as": RpString = ", as well as": GoSub FindIt
SrString = " without": RpString = ", without": GoSub FindIt
SrString = " which": RpString = ", which": GoSub FindIt
SrString = " followed": RpString = ", followed": GoSub FindIt
SrString = " as described": RpString = ", as described": GoSub FindIt
SrString = " as noted": RpString = ", as noted": GoSub FindIt
SrString = " as mentioned": RpString = ", as mentioned": GoSub FindIt
SrString = " where": RpString = ", where": GoSub FindIt
SrString = "&": RpString = " and ": GoSub FindIt
SrString = ",,": RpString = ", ": GoSub FindIt
SrString = ", ": GoSub FindIt: 'rpstring is the same as above
SrString = "nontoxic appearing": RpString = "nontoxic-appearing": GoSub FindIt
SrString = "well appearing": RpString = "well-appearing": GoSub FindIt
SrString = "M.D.": RpString = "MD": GoSub FindIt
SrString = "TPA": RpString = "alteplase": GoSub FindIt
SrString = "TNK": RpString = "tenecteplase": GoSub FindIt
SrString = "DSS": RpString = "docusate sodium": GoSub FindIt
SrString = " percent": RpString = "%": GoSub FindIt
SrString = "CK-MB%": RpString = "CK-MB percent": GoSub FindIt
SrString = "speech, swallowing difficulty": RpString = "speech or swallowing difficulty": GoSub FindIt
SrString = "^pOPERATION:": RpString = "^pNAME OF OPERATION:": GoSub FindIt
SrString = "^pOPERATIONS:": RpString = "^pNAME OF OPERATIONS:": GoSub FindIt
SrString = "^pPROCEDURE:": RpString = "^pNAME OF PROCEDURE:": GoSub FindIt
GoSub Page1
Application.ScreenUpdating = true:Application.ScreenRefresh
Exit Sub
FindIt:
GoSub Page1
With Selection.Find
.Text = SrString
.MatchCase = True
.MatchWholeWord = True
.ClearFormatting
.Replacement.Text = RpString
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
Return
Page1: Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1": Return
End Sub
I got a "Compile error: Syntax error" when I first used it, with Dim SrString RpString highlighted, so experimenting, I just deleted that whole line, and the macro works great now except for the double commas still, which may be a totally unfixable situation (discovered that when in EditScript, Find will find a macro-created ,, but Find/Replace refuses to acknowledge any instances of those; if I add 2 commas anywhere myself after entering the report, Find/Replace works, or even just add an extra comma to one that wasn't placed by the macro). I'm okay with that, though; easy enough to fix doubled commas as I go, which are especially easy to see and pretty rare anyway.
Have to wait to get some more H&Ps, ERs, etc., to check on Revised FixPX (had almost all OPs last night), but I think it's working well now (had one report with a PE section, though forgot to check to see how it was paragraphed before running General Macro, but no breaking of headings at all there).
No doubt there are conflicts with commands or such that are just a part of EditScript, because all of my tests in Word by itself have worked just fine too. It's not until I get into EditScript that things don't work totally as expected. I have a couple of screenshots with more info regarding the original error messages I got when Dim SrString RpString was still in macro when I ran it the first time inside of ES that I could send you by e-mail if you want to see them out of curiosity (something to do with EditScriptShortCuts and Bindkeys). And thanks also for the "& = and" upgrade!
And certainly makes it much simpler to add new ones now. I've added in about another 10 so far tonight already.
Again, I can't thank you enough. Editing is almost "fun" now. It is most definitely more efficient and faster and will get more so as I add more replacements in along the way.