Intercepting built-in commands

A

Andrew Savikas

I'm familiar with modifying/intercepting built-in
commands, using macros named with the command's name
(i.e., FileSave, FormatStyle, etc.).

And I understand that you can go to the Macros dialog,
select from the list of built-in commands, and create a
macro from there.

Here's my question:

If I go to the list of Word Commands, and Select "Style",
then tell Word to create that in my current template, I
get this:

Sub Style()
'Styles macro
'Applies an existing style or records a style by example
WordBasic.Style
End Sub

Under what circumstances would this macro be called (I
recognize that WordBasic.Style is invalid without a
style)?

I'd like to intercept the application of a specific style,
and can't find any information on modifying built-in
commands that require parameters (like Style or Font).

Any help would be appreciated.

Thanks,
Andrew Savikas
 
K

Klaus Linke

Hi Andrew,

The command you are looking for is "RedefineStyle", not "Style".

(BTW, I don't think you can intercept (WordBasic) commands that take
arguments.)

Regards,
Klaus
 
W

Word Heretic

G'day "Andrew Savikas" <[email protected]>,

not only is Klaus spot on the $$$, but do tell us, what are you trying
to achieve and maybe we can help with that :)


Andrew Savikas said:
I'm familiar with modifying/intercepting built-in
commands, using macros named with the command's name
(i.e., FileSave, FormatStyle, etc.).

And I understand that you can go to the Macros dialog,
select from the list of built-in commands, and create a
macro from there.

Here's my question:

If I go to the list of Word Commands, and Select "Style",
then tell Word to create that in my current template, I
get this:

Sub Style()
'Styles macro
'Applies an existing style or records a style by example
WordBasic.Style
End Sub

Under what circumstances would this macro be called (I
recognize that WordBasic.Style is invalid without a
style)?

I'd like to intercept the application of a specific style,
and can't find any information on modifying built-in
commands that require parameters (like Style or Font).

Any help would be appreciated.

Thanks,
Andrew Savikas

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 
A

Andrew Savikas

There are really quite a few things I would do if I knew
how to intercept the application of a particular style
(the language about redefining an existing one came from
Word, not from me)

For instance, I'd love to be able to prevent users from
applying a paragraph style to only a portion of a
paragraph (we all know what kind of fun that leads to),
something like this (I know it's oversimplified):

Sub Style(Applied_Style)
Selection.Paragraphs(1).Range.Style = Applied_Style
End Sub

Or, it would be great if I could use SEQ fields to apply
numbering to styles automatically (by intercepting their
application).

Thanks!
Andrew Savikas
 
W

Word Heretic

G'day "Andrew Savikas" <[email protected]>,

ahhhh. I have some bad news for you I am afraid. It is possible to
monitor every damn keystroke - AT THE TOTAL EXPENSE OF USABILITY. It
turns a P4 into a 486. So I wont even bother trying to discuss that
option - its essentially pointless. For the small gains you make, you
lose a heap. wdls can be a heap faster if you are prepared to lose all
social skills and become a full-on softie.

However, we always have more that one way to skin a cat.
www.mvps.org/word/FAQs/index.html has a heap of VBA. So does my Word
VBA Spellbook. If you need help coming up to speed start there.

Amongst the gems online you will find a batch processing routine. I
can't remember which way they do it, there's a few different ways
basically.

The concept is you post-process documents back to your standards. Do
this in a global template and you can then instantly fix any loaded
document anytime. Also include a batched version and you can do entire
folders and their sub folders with the click of a button.

FWIW, I just finished writing a future time line for the field of
technical writing. It shows an increase in these sorts of tools over
the next 8 years, culminating in expert systems that leave many
editors out of work. If you want to ride that wave, start paddling now
:)




Andrew Savikas said:
There are really quite a few things I would do if I knew
how to intercept the application of a particular style
(the language about redefining an existing one came from
Word, not from me)

For instance, I'd love to be able to prevent users from
applying a paragraph style to only a portion of a
paragraph (we all know what kind of fun that leads to),
something like this (I know it's oversimplified):

Sub Style(Applied_Style)
Selection.Paragraphs(1).Range.Style = Applied_Style
End Sub

Or, it would be great if I could use SEQ fields to apply
numbering to styles automatically (by intercepting their
application).

Thanks!
Andrew Savikas

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 
C

Cindy Meister -WordMVP-

Hi Andrew,
I'd love to be able to prevent users from
applying a paragraph style to only a portion of a
paragraph (we all know what kind of fun that leads to),
This is now supported in Word 2003...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

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