Move cursor (not insertion point) to corner?

H

HONYAKUKA

Word 2000

Is there code for moving the cursor? (I'm referring to the mouse pointer, such
as the arrow, not the insertion point). Sometimes I'd like to get the cursor
out of the way quickly because it's blocking text. Too lazy to reach for the
mouse, so I'd like to assign a keyboard shortcut to this task.

Thanks.

Jay
 
W

Word Heretic

G'day (e-mail address removed) (HONYAKUKA),

Difficult code involving system calls, not Word VBA calls.

Steve Hudson
Word Heretic Sydney Australia
Tricky stuff with Word or words

Email: WordHeretic at tpg.com.au


HONYAKUKA was spinning this yarn:
 
A

Andra

try

Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As
Long) As Long
Sub movemouse()
ret = SetCursorPos(0, 0)
End Sub
 
H

HONYAKUKA

Thanks. It works fine, and so simple.

Do you have any info on resource materials on DLL libraries? I have no idea
what exists in the first place. Thanks.

Jay
 
L

Lars-Eric Gisslén

Jay,

If you go to http://msdn.microsoft.com you vill find all resources you will
need for development under the Windows environment and Microsoft products.
Be prepared to that it will sometimes be a nightmare to find the information
you need. The search engine could be many times better. For just Win API
calls I use a help file with only the Win API prototypes (for C/C++)
documented and when you know which API you want to use it takes only a few
seconds to find it. It's a 20mb helpfile and I don't know if you can find it
on the MSDN site.
 
L

Larry

Where does that Declare Function line go in the module? If I paste it
at the top, it turns into a red font.

Larry
 
L

Larry

Stupid question, sorry. I had to join the broken line in the Declare
statement and put it and the macro in their own module. I assigned a
key, but it doesn't work.
 
L

Larry

It runs correctly when I run it from the Macros dialog box, but not when
I attempt to run it with an assigned keystroke.

also, it is possible to place the Declare Function statement in the same
module with my other macros, or does each Declare statement need to be
at the top of its own module?

Larry
 
H

HONYAKUKA

Larry:

Subject: Re: Move cursor (not insertion point) to corner?
From: "Larry" (e-mail address removed)
Date: 2/1/2004 8:49 PM Eastern Standard Time
Message-id: <e#[email protected]>

It runs correctly when I run it from the Macros dialog box, but not when
I attempt to run it with an assigned keystroke.

I don't know why this isn't working. My assigned keystroke works fine. Make
sure you don't have your new macro in two places (I cut and pasted mine into
two modules and had to remove it from one to assign a keystroke properly).
also, it is possible to place the Declare Function statement in the same
module with my other macros, or does each Declare statement need to be
at the top of its own module?

Take a look at the "Declare Statement" page in the Word (or Office) VBA help
file. You can choose either way, by using Public vs Private.


Jay
 
L

Larry

Thank you!

I moved the Declare Function statement and the macro into my main
module, and changed it to Public Declare, and now the keystroke works.
(I'm not sure which of those steps made the difference.)

Also, I didn't realize before that two Declare statements could be
together at the top of the module. Because no line appeared between
them when I tried it, I had thought that that was not doable. But it
is.

Larry
 

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