How do I copy a macro module from an add-in to the active document? (I'm
trying to insert an auto-open macro by copying it into the doc.)

I've used the Application.OrganizerCopy method to copy a toolbar that way,
but it fails if I try to copy a module. And if you open the organizer and
examine an add-in, you can't see the modules either.

You can only see the modules in the add-in when it's actually open.

Any help will be appreciated.

Bear

Re: Copy a module from add-in to active doc by Jezebel

Jezebel
Fri Jun 30 04:06:41 CDT 2006

You'reon the right track: open the add-in, then you can copy the module.
Unless you're trying to do this programmatically, in which case you're
almost certainly on the wrong track: manipulating code through code is
tricky to say the least, and precluded entirely in many security set-ups.




"Bear" <Bear@discussions.microsoft.com> wrote in message
news:5CEA05C0-F034-4D3D-B39A-C61A39AD8D78@microsoft.com...
> How do I copy a macro module from an add-in to the active document? (I'm
> trying to insert an auto-open macro by copying it into the doc.)
>
> I've used the Application.OrganizerCopy method to copy a toolbar that way,
> but it fails if I try to copy a module. And if you open the organizer and
> examine an add-in, you can't see the modules either.
>
> You can only see the modules in the add-in when it's actually open.
>
> Any help will be appreciated.
>
> Bear



Re: Copy a module from add-in to active doc by Bear

Bear
Fri Jun 30 08:29:01 CDT 2006

Jezebel

That's exactly what I'm trying to do -- add code programatically. And after
much research, I came to the conclusion that the inability to copy code
programatically (using the organizer object) was, indeed, intended operation,
and a virus safeguard.

Maybe you can offer some suggestions for an alternative approach.

I'm setting up the target document to display variables stored in a table in
another document. When the target document opens, I need to load the table
into an array for reference during the session.

I could set up the document by attaching a template that already has an
auto-open macro, but then the original template wouldn't be available, etc. I
just prefer the idea of putting my code in an add-in, copying a toolbar that
accesses that code into the target document, etc.

Any ideas?

Bear

> You'reon the right track: open the add-in, then you can copy the module.
> Unless you're trying to do this programmatically, in which case you're
> almost certainly on the wrong track: manipulating code through code is
> tricky to say the least, and precluded entirely in many security set-ups.
>
>
>
>
> "Bear" <Bear@discussions.microsoft.com> wrote in message
> news:5CEA05C0-F034-4D3D-B39A-C61A39AD8D78@microsoft.com...
> > How do I copy a macro module from an add-in to the active document? (I'm
> > trying to insert an auto-open macro by copying it into the doc.)
> >
> > I've used the Application.OrganizerCopy method to copy a toolbar that way,
> > but it fails if I try to copy a module. And if you open the organizer and
> > examine an add-in, you can't see the modules either.
> >
> > You can only see the modules in the add-in when it's actually open.
> >
> > Any help will be appreciated.
> >
> > Bear
>
>
>

Re: Copy a module from add-in to active doc by Jezebel

Jezebel
Fri Jun 30 18:46:49 CDT 2006

Trap the DocumentOpen event in the add-in.



"Bear" <Bear@discussions.microsoft.com> wrote in message
news:935CCC80-FE5A-4AAF-9846-23216606A32D@microsoft.com...
> Jezebel
>
> That's exactly what I'm trying to do -- add code programatically. And
> after
> much research, I came to the conclusion that the inability to copy code
> programatically (using the organizer object) was, indeed, intended
> operation,
> and a virus safeguard.
>
> Maybe you can offer some suggestions for an alternative approach.
>
> I'm setting up the target document to display variables stored in a table
> in
> another document. When the target document opens, I need to load the table
> into an array for reference during the session.
>
> I could set up the document by attaching a template that already has an
> auto-open macro, but then the original template wouldn't be available,
> etc. I
> just prefer the idea of putting my code in an add-in, copying a toolbar
> that
> accesses that code into the target document, etc.
>
> Any ideas?
>
> Bear
>
>> You'reon the right track: open the add-in, then you can copy the module.
>> Unless you're trying to do this programmatically, in which case you're
>> almost certainly on the wrong track: manipulating code through code is
>> tricky to say the least, and precluded entirely in many security set-ups.
>>
>>
>>
>>
>> "Bear" <Bear@discussions.microsoft.com> wrote in message
>> news:5CEA05C0-F034-4D3D-B39A-C61A39AD8D78@microsoft.com...
>> > How do I copy a macro module from an add-in to the active document?
>> > (I'm
>> > trying to insert an auto-open macro by copying it into the doc.)
>> >
>> > I've used the Application.OrganizerCopy method to copy a toolbar that
>> > way,
>> > but it fails if I try to copy a module. And if you open the organizer
>> > and
>> > examine an add-in, you can't see the modules either.
>> >
>> > You can only see the modules in the add-in when it's actually open.
>> >
>> > Any help will be appreciated.
>> >
>> > Bear
>>
>>
>>



Re: Copy a module from add-in to active doc by Bear

Bear
Wed Jul 05 10:04:02 CDT 2006

Jezebel

Yes, thanks. That's going to work just fine. In fact, I'm going to abandon
copying the toolbar as well, and build it programatically into the document.

An additional benefit of trapping the events is that I can now have multiple
documents open, trap the DocumentChange event, and switch between different
tables.

Good deal.

Bear