Group: microsoft.public.word.vba.general
From: =?Utf-8?B?aG9tZXRlYW1qaWxs?=
Date: Tuesday, March 25, 2008 6:38 PM
Subject: RE: Macro Conditional Statement

Thank you so much. I'm so in over my head, and this should really help.

Take care!
--
hometeamjill :)


"Jean-Guy Marcil" wrote:

> "hometeamjill" wrote:
>
> > Thanks for your response.
> >
> > The patient numbers come from two different sources. A transcriptionist has
> > typed the number from a dictation and then her reports go to an editor to be
> > pasted into our client’s database. The editor types the patient number in my
> > client’s medical manager program which then pulls up a blank Word template
> > that contains the patient’s demographics at the top. At this point, she runs
> > the macro that pastes the report into that template. The macro pulls the
> > patient’s name and number from the demographics section at the top of the
> > template and places the number and name directly on top of the number and
> > name typed by the transcriptionist (please see example in original question).
> > The macro then highlights both of these lines and stops there. Then the
> > editor is supposed to make sure the numbers match before hitting the delete
> > key and deleting both lines. Occasionally the editor has transposed two
> > numbers and typed in the wrong patient number. If she doesn’t notice the
> > numbers don’t match, the report ends up getting pasted into the wrong
> > patient’s account.
> >
> > So, the most important thing for me is to prevent the editor from continuing
> > with the pasting process if the numbers don’t match. It would be nice if the
> > macro was written to use a pop-up box that says something like “ABORT” so the
> > editor knows what’s going on if the numbers don’t match, but that’s not as
> > important as the first step.
> >
> > Hopefully I explained that okay. Any advice would be greatly appreciated.
> >
>
> Place those in a table as you suggested.
> Then, make sure that the first column contains only the patient number.
> After that it is easy to compare the content of each cell.
>
> If the content is different, use a message box to pop up a warning,
> something like:
>
> With Selection.Tables(1)
> If .Rows(1).Cells(1).Range.Text = .Rows(1).Cells(1).Range.Text Then
> MsgBox "ABORT, ABORT, mismatch in patient number... ABORT,
> ABORT!!!", _
> vbCritical, "Error"
> Exit Sub
> End If
> End With
>