how can I create a macro from text I have already typed?

C

Craig

I frequently find myself typing chunks of text that, once I’ve finished, I
realize I’d like to save for repeated future use. But since I didn’t have the
macro “recorder†turned on when I was typing, there is no macro created. I’ve
tried to remedy this by by copying the text and then pasting it into a blank
page with the recorder feature running.

For example, if I type “Now is the time for all good men to come to the aid
of their party,†then copy that text, turn on the macro recorder, paste that
text into the macro, and then turn off the recorder, I have created a great
little macro that reads “Now is the time….â€

However, the very next time I copy any other text (“The quick brown fox
jumped over the lazy dogâ€), regardless of my reason for doing so, my “Now is
the time†macro changes to “The Quick brown fox…â€, or whatever other words I
have copied to my clipboard. In effect, the macro I created is a macro that
ALWAYS picks up whatever I have pasted to my clipboard, not a macro that
repeats the same desired text over and over.

Any thoughts about how I can create a macro from text I have already typed?

Thank you very much for any insight!!
 
J

Jay Freedman

Let me guess... you're used to working in WordPerfect? Word doesn't use
macros to insert chunks of text (well, it could, but it's like using an
elephant gun to hunt mice).

In Word, this function is served by AutoText and/or AutoCorrect. See
http://www.word.mvps.org/FAQs/Customization/AutoText.htm for a discussion.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
B

bhartman36

I frequently find myself typing chunks of text that, once I've finished, I
realize I'd like to save for repeated future use. But since I didn't have the
macro "recorder" turned on when I was typing, there is no macro created. I've
tried to remedy this by by copying the text and then pasting it into a blank
page with the recorder feature running.

For example, if I type "Now is the time for all good men to come to the aid
of their party," then copy that text, turn on the macro recorder, paste that
text into the macro, and then turn off the recorder, I have created a great
little macro that reads "Now is the time...."

However, the very next time I copy any other text ("The quick brown fox
jumped over the lazy dog"), regardless of my reason for doing so, my "Now is
the time" macro changes to "The Quick brown fox...", or whatever other words I
have copied to my clipboard. In effect, the macro I created is a macro that
ALWAYS picks up whatever I have pasted to my clipboard, not a macro that
repeats the same desired text over and over.

Any thoughts about how I can create a macro from text I have already typed?

Thank you very much for any insight!!

The easiest way to do this, I think, is the following:

1) Copy what you want to use in the macro into the clipboard.
2) Visual Basic editor to create a new macro.
3) The command you're looking for is:

Selection.TypeText "Whatever you want to write here."

I agree with the person who said it's probably overkill, but it's
simple and it works, if all you want is to put some text at the
insertion point.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top