Re: Capture ALL movements...event?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello! I'm trying to get this to work, because this is the type of thing I
need: http://blogs.msdn.com/pstubbs/archive/2004/12/31/344964.aspx but it is
not working. I put this function in a cell (=GetNumberFromVSTO()) but it
doesn't find that function. Can you try it and see if you can get it to
work? Wait, do you have VSTO? Sorry this post is so long, but I have
learned lots from you guys. Thanks!

"Tony Jollans" wrote:

Hi Brenda,

I don't know whether *every* possible key combination can be trapped but the
basic code to set the trap is ...

KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyW), _
KeyCategory:=wdKeyCategoryMacro, _
Command:="MyMacroForW"

And then ...

Sub MyMacroForW()

' Do whatever you want here
' Execute whatever the user expects from pressing W
' (Maybe) Do something else here

End Sub

To do this properly you will need to check beforehand what existing key
assignments there are - and (a) make sure they are honoured and (b) reassign
them afterwards.

The mouse is different. To trap mouse actions in the document you can
probably rely on WindowSelectionChange. To trap those in the interface but
outside the document you'll need to intercept every command bar control -
and I don't think you can trap things in the Task Pane but they may not all
matter.

It might all be possible - I really don't know - but it is most definitely a
major undertaking and probably a big performance hit. If I have time I might
look into it one day or --- <jest> if you want to pay me large sums of money
I might do it sooner </jest>

--
Enjoy,
Tony


"BrendaLL" <BrendaLL@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:056B2ED8-3F2B-4F3B-B7B6-300AC4310441@xxxxxxxxxxxxxxxx
Hi Tony

I was just wondering more about the macros that you were talking about.
How
would I add a macro to a single keystroke? Like if I want them to hit the
'w' key, and perform a function behind that?

Or is there an article that talks about that?

Thanks!

"Tony Jollans" wrote:

No. There just simply isn't an event which fires off every keystroke.

It might, theoretically, be possible to assign every keystroke to a
macro
and perform some appropriate action, but it would be extremely difficult
to
write and a hell of a perfomance hit and would probably still fail in
some
cases (field updates, for example). Alternatively some low level APIs
might
get you there.

For sure this won't be easy even if it's possible. Is the status bar
that
important to you?

--
Enjoy,
Tony


"Brenda" <Brenda@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:AC399026-856F-40F9-87E6-D6FB62407323@xxxxxxxxxxxxxxxx
Tony

They do you have something else that you use that works better?

--
Brenda


"Tony Jollans" wrote:

Yes, it is the closest - but still quite a long way off.

--
Enjoy,
Tony


"Jonathan West" <jwest@xxxxxxxx> wrote in message
news:u8NT3PaLGHA.3896@xxxxxxxxxxxxxxxxxxxxxxx

"Brenda" <Brenda@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1368F07C-B7EC-4862-A83E-9A1BDF6B89EE@xxxxxxxxxxxxxxxx
Currently I am trying to create my own StatusBar because the
Word
StatusBar
doesn't display when you are using it with Internet Explorer.
My
question
is
what event do you use to capture every movement of the
cursor(pointer)
so
I
can display the current line, section, column, etc...? I've
tried
Me.SelectionChange but it only captures some of the movements.
It
doesn't
capture when I hit the Enter button, etc...

Any ideas? Thanks for your time!

The closest I think you can get to this is the
WindowSelectionChange
event.
The following article shows you how to write event procedures for
application-level events

Writing application event procedures
http://www.word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition
www.classicvb.org










.


Quantcast