OT: Word VBA question

  • Thread starter Thread starter John Coleman
  • Start date Start date
J

John Coleman

Greetings,
In principle I hate to post off topic, but I am impressed by the
expertise that many of the regular posters here have in the wider world
of VBA programming and not just Excel. I did a google search in the
word programming newsgroup (somewhat dead compared to here) and saw
that most of the posts asking similar questions had no responses at all
- not a good sign.

So: is there a way to mimic "OnKey" in Word 2000? I want to write a
small text editor for programs intedned to run in the computer algebra
system Derive, which lacks a good editor. What I would like to do is to
have a macro fire whenever I type a "(" (to keep track of logical depth
and set up an appropriate indentation), and another macro to fire when
I type a ")" (to highlight the text between it and the matching left
parenthesis and update my depth perception). For those of you who have
seen it, I would like to mimic some of the functionality of "Dr.
Scheme", an intelligent editor for the Scheme dialect of Lisp. I would
have little problems with the macros themselves, if I could only find a
way to attach them to the keys. Compared to Excel, Word seems to have
few candidate events. Any ideas?

Thanks for tolerating this OT post.

-John Coleman
 
Not an expert on Word, but AFAIK, KeyBindings (et al) is the closest (and
only) thing in the ballpark.
 
George said:
Not an expert on Word, but AFAIK, KeyBindings (et al) is the closest (and
only) thing in the ballpark.
George,
Thanks for your reply. I was afraid that this was the case. The problem
with key bindings is that (I think) they require a key combination like
Alt+( and not ( alone. This is definitely the case from the user
interface and the documentation I've looked at suggests this as well,
but maybe VBA would give you a way to create a key binding with a
single normal key. I'll have to play around. I was hoping that there is
a standard but undocumented trick someone knew.

-John Coleman
 

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

Back
Top