S
schafer
How to get (recorded) macros to run in active window only? Macros run in a
previously active window, sometimes.
previously active window, sometimes.
Anne Troy said:Where's the cursor when the macro is run? What's the macro?
*******************
-snip-Chuck said:You might want to look up the "Activewindow" object in VBE help.
Alternatively create an object that points to the document you want to work
on, rather than the "Activedocument" for instance,
Dim objDoc as document
Set objDoc = Documents.Add 'additional parameters if necessary
With objDoc
'work magic here
Jezebel said:The better approach is not to use the windows at all. It's much simpler if
your macros work directly with the relevant storyrange objects.
schafer said:-snip-
Thanks Chuck,
I'll give it a try. My document is actually a scratch buffer -- the macro
formatted text gets picked up and pasted into another document manually. I
assume that 'work magic here is where I nestle my macro. I have some
limited experience and skills with programming, and I would like to keep it
that way. I can tweak a simple line or two, but to learn VBE proper is too
great a learning curve for my simple needs. I love the macro record function,
needless to say. Usually, with a little reverse engineering, I can make minor
fixes. But this one stumped me.
Lenny
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.