NewParagraph Event: does it exist?

R

Rich007

Dear Experts,

Is there a way to trigger a macro to run whenever a new paragraph is
created? Something like a NewParagraph event???

I've tried using a key binding on the Enter key, but unsurprisingly it is
causing problems with other things (e.g. using enter to insert an auto text
no longer works, and using the enter key in the To…, Cc… and Bcc… boxes when
using Word as the Outlook e-mail editor doesn't work properly either).

The really neat way to do what I want to do (control how a bulleted list
ends) would be to have a macro run on a NewParagraph event.

Any ideas anyone?

Cheers
Rich
 
R

Rich007

Well obviously it doesn't exist, but is there really no way of triggering a
macro to run automatically when a new paragraph is created? No cunning work
arounds involving "ActiveDocument.Paragraphs.Count"? That would work, but
how would you make <that> code run?!??

Please help.

Cheers
Rich
 
J

Jay Freedman

You've put your finger on the problem right there: Word has no
reasonable way to run a macro only when a new paragraph is created.

The list of events that Word supports -- a very short list for so
large a program -- is in the table at the end of Bill Coan's article
at
<http://msdn2.microsoft.com/en-us/library/aa140279(office.10).aspx>.
The only event that might be even slightly useful for your purpose is
WindowSelectionChange. The difficulty here is that this event fires
far too often, so you have to make sure your handler doesn't take too
much time to execute. If it does something time-consuming, like
evaluating ActiveDocument.Paragraphs.Count in a large document, Word's
performance will deteriorate noticeably.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

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