I type out medical reports on a lot of different patients, some of whom have
odd spellings for their names. I have been putting the name for each report
into an autocorrect entry. For example, if the patient's name is
"Throckmorton," I might assign that to "uu." Then instead of typing
"Throckmorton" and maybe forgetting the spelling, I just type "uu." I do this
for each report, always using the same autocorrect shortcut "uu."

What I would like to do is to be able to highlight or select the name when
it first appears and then run a macro which automatically assign it to "uu."
I have experimented with the macro recorder by highlighting the name, hitting
<ctrl><C>, and then opening up the autocorrect dialog box and substituting
the old patient name with the new one, but Word seems to put in the literal.
There has to be some way of getting Word to paste the clipboard contents into
autocorrect, perhaps via some kind of variable assignment.

Regards,

Alan

Re: macro to copy clipboard to autocorrect entry, Word 2003 by Jay

Jay
Sat Jan 19 06:00:41 PST 2008

On Sat, 19 Jan 2008 01:48:00 -0800, Alan Stancliff <Alan
Stancliff@discussions.microsoft.com> wrote:

>
>I type out medical reports on a lot of different patients, some of whom have
>odd spellings for their names. I have been putting the name for each report
>into an autocorrect entry. For example, if the patient's name is
>"Throckmorton," I might assign that to "uu." Then instead of typing
>"Throckmorton" and maybe forgetting the spelling, I just type "uu." I do this
>for each report, always using the same autocorrect shortcut "uu."
>
>What I would like to do is to be able to highlight or select the name when
>it first appears and then run a macro which automatically assign it to "uu."
>I have experimented with the macro recorder by highlighting the name, hitting
><ctrl><C>, and then opening up the autocorrect dialog box and substituting
>the old patient name with the new one, but Word seems to put in the literal.
>There has to be some way of getting Word to paste the clipboard contents into
>autocorrect, perhaps via some kind of variable assignment.
>
>Regards,
>
>Alan

Hi Alan,

The mistake is in trying to get the clipboard involved. Just create the
AutoCorrect entry directly from the selection:

Sub uuAutoCorrectFromSelection()
AutoCorrect.Entries.Add Name:="uu", Value:=Selection.Text
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.

Re: macro to copy clipboard to autocorrect entry, Word 2003 by AlanStancliff

AlanStancliff
Sat Jan 19 23:33:00 PST 2008


> Sub uuAutoCorrectFromSelection()
> AutoCorrect.Entries.Add Name:="uu", Value:=Selection.Text
> End Sub
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org
> Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.

Thank you Jay. That's exactly what I needed and it worked!

Regards,

Alan Stancliff
www.alanstancliff.com

Selecting range in Word 2003 by AlanStancliff

AlanStancliff
Tue Jan 22 20:48:00 PST 2008

I have been having trouble posting a question here, so I hope I've done this
correctly.

I've written part of a macro that pastes between two markers. The first
marker is //// and the second marker is \\\\. The macro then massages some of
the data between those two markers. It ends up looking like this:
////
bunch of data here
More data here
Even more data here
\\\\

What I want to do now is <ctrl><home> to the top of the document, search for
the //// marker, then continue to search for the \\\\ marker, so that all of
the stuff between the markers, as well as the markers themselves, are
selected.

However, I do not know how to do that. Can anyone give me some ideas on how
to accomplish this?

Regards,

Alan

Re: Selecting range in Word 2003 by Helmut

Helmut
Wed Jan 23 07:29:41 PST 2008

Hi Alan,

Sub Test555()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "////*\\\\\\\\"
.MatchWildcards = True
If .Execute Then
rDcm.Select
End If
End With
End Sub

see: http://www.gmayor.com/replace_using_wildcards.htm

The 8 backslahes are required because in a wildcard search
a backslash is a special character and has to be doubled
in order to find it.

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP

Re: Selecting range in Word 2003 by AlanStancliff

AlanStancliff
Thu Jan 24 23:22:00 PST 2008

Thanks Helmut,

I would have replied here sooner, but I have been having trouble being able
to respond to posts or create new posts. I am now on my work computer instead
of my home computer, and this seems to be working better.

What I wanted to say is thank you so much for the explanation and the link.
I found them both very informative.

Regards,

Alan

"Helmut Weber" wrote:

> Hi Alan,
>
> Sub Test555()
> Dim rDcm As Range
> Set rDcm = ActiveDocument.Range
> With rDcm.Find
> .Text = "////*\\\\\\\\"
> .MatchWildcards = True
> If .Execute Then
> rDcm.Select
> End If
> End With
> End Sub
>
> see: http://www.gmayor.com/replace_using_wildcards.htm
>
> The 8 backslahes are required because in a wildcard search
> a backslash is a special character and has to be doubled
> in order to find it.
>
> --
>
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP WordVBA
>
> Vista Small Business, Office XP
>