macro to copy keystrokes?

A

Alynn Baker

In early versions of Wordperfect, I was able to create macros that captured
keystrokes and replayed them. I wonder if there is a way to do that in Word
2000?

For example, I have several folders under "my documents." I would create a
macro that lets me open a particular folder so I can choose any file to open
from it. But if I record a macro, I have to go all the way to choosing a
file to open and then the macro always opens that file rather than stopping
the file-open dialog so I can choose any file in that folder. If I could
just record the keystrokes as far as doing file>open>choose the folder and
then wait there for my choice of documents, it would be helpful.

Is there a way to just record the keystrokes?

(Please note that someone, years ago, created just such a file-open macro
for me. So I do have a macro to do what I said above. But it's not something
like a macro that replays keystrokes that I could use for any series of
keystrokes. I just used that as an example.)

I hope this all makes sense!
 
J

Jay Freedman

It makes sense, but Word very much does _not_ work that way. Even when
the macro recorder works (which isn't often), it isn't geared to
recording keystrokes. As in your example, I could write a macro that
would do what you ask -- and you could write one, too, with a little
study -- but the recorder isn't the way to get there. If you want to
use it as a starting point, though, see
http://www.word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm.

Instead of trying to force Word to your wishes, step outside the Word
box and grab the free utility from www.autohotkey.com. I think you'll
be happier with something that was intended to play back keystrokes.
 
A

Alynn Baker

I found the mvps article interesting and deleted some of the extra verbiage
in my older Word macros. Thanks for that and for leading me to look at
autohotkeys.

I d/led autohotkey and will need more than the last hour I've spent trying
to understand anything.

Anyway, I'm most interested in doing one thing at this time (instead of
just copying keystrokes which I did with the autohotkey program and didn't
like the results as you hinted! ).

My primary interest is to send a Word document, which is already saved on
screen, to a specific home-network folder while still in Word. (I already
created a batch file outside of Word that finds all files created today in
my data folders and xx-copies them to that network folder)

I created an autohotkey as follows:

#a::send !fa"\\8400desktop\disks\from laptop\ "

In Word 2000 it does execute the menu command alt file save-as to save in my
network folder called "\disks\from laptop." But it types out
\\8400desktop\disks\from laptop\ " where the file name belongs. I have to
type in a new filename before the closing quote mark. That's a start.

I would like it to use the filename already set instead of typing in the
name. Is there a command in authotkey to keep the filename?

If Word2000 would only use all the lines that show up in the sendto folder
in Explorer, I wouldn't have this problem. But it won't utilize the sendto
lines I have to send to specific folders.

Thanks again for the leads.



If you want to
 
J

Jay Freedman

I'm still not quite clear on what you're doing -- for example, do you
always want to open from or save to the same folder, or does the
folder name change from day to day?

Anyway, that sort of thing can be done by writing (_not_ by recording)
a macro that opens the built-in dialog with the desired folder already
selected. Look at these articles, and come back here if you can't see
how to fit the pieces together to suit your work flow:

http://www.word.mvps.org/FAQs/MacrosVBA/ChangeSaveAsPath.htm
http://word.mvps.org/FAQs/MacrosVBA/SetDefFilename.htm
http://www.word.mvps.org/FAQs/MacrosVBA/WordDlgHelp.htm
 

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