Re: Event Driven Macro by MT
MT
Fri Jul 09 01:15:17 CDT 2004
Thanks for the help! As it turns out, I had all the pieces in place except
the last one. The special document is based on a separate template that is
loaded with custom macros, and no other documents are (or will be) based on
that template. I created an EditPaste macro and have it calling my existing
routine. There's no need to assign the EditPaste macro to CTRL+V because
it's already assigned to that key combination, as well as SHIFT+INSERT, and
it works when using Paste off the Edit menu, or the normal Paste button on
the toolbar.
-- Tom
MT DOJ Help Desk
Making the world a safer place.
"Jezebel" <dwarves@heaven.com.kr> wrote in message
news:uYLPWPWZEHA.3144@TK2MSFTNGP12.phx.gbl...
> If the macro is in a template other than Normal, it will run only for
> documents to which that template is attached. So one method is to base
your
> 'special' document on its own template, and the other two on a different
> template.
>
> Alternatively, you could have the macro run for all paste operations, but
do
> nothing special unless the active document is the one you are interested
in;
> in all other cases it simply does an ordinary paste.
>
> That said, trapping the 'paste' event is not entirely straightforward. You
> can write a macro called EditPaste -- that will run in place of the
built-in
> command if the user selects Paste from the edit menu. You can assign
Ctrl-V
> to the macro, to trap the keyboard shortcut.
>
> There are also the PasteSpecial possibilities, but perhaps you can ignore
> them in this case.
>
>
>
>
> "MT DOJ Help Desk" <NoEmail@Please.com> wrote in message
> news:u%23ar40VZEHA.3420@TK2MSFTNGP12.phx.gbl...
> > Word 2000
> >
> > I have a document where I need to control what happens when the users
> pastes
> > a block of text into the document. Currently, I have a macro assigned
to
> a
> > special toolbar button. This works fine, but if the user forgets to use
> the
> > toolbar button, things get more complicated. My macros are designed so
> that
> > they will try to handle things correctly if the user does NOT paste data
> > into the document using the toolbar button, but there's just no way to
> > predict all the things that may go wrong in that scenario.
> >
> > I've been thinking that if I can make the macros run every time
something
> is
> > pasted into the document, no matter what method is used to paste the
data,
> > that my problems would be solved. So I started thinking of an "on
event"
> > macro that would run each time something is pasted into the document.
The
> > problem is that this on-event macro would need to work in only one
> specific
> > document. For example, if the user has 3 documents open, the on-event
> paste
> > macro would need to run in only one document, and pasting in the other
two
> > documents would need to work normally.
> >
> > Is there any way to setup an on-event macro for pasting so that it works
> in
> > only one document (as opposed to Word in general)?
> >
> > --
> >
> > MT DOJ Help Desk
> >
> > Making the world a safer place.
> >
> >
>
>