Discussion:
Contol when an Addin Execs
(too old to reply)
"" <jpgmt_at_sbcglobal_dot_net>
2006-10-25 08:18:44 UTC
Permalink
I need my addin's modules to exec for only a specific template, so placing
the code that calls that template works, but not with Med security settings,
perhaps there's a way around this?

The macros work when manually executed, I have an automated process that
prints doc's w/little or no user intervention, similar to right-clicking on
a template and selecting Print.

My first attempt I put code into the special template that called the module
in the addin and all was fine and dandy.

This fine & dandy setup, ONLY works when security is set to Low, so I tried
to implement oApp_DocumentOpen in ThisDocument, and call my module, but that
fails to execute because of two reasons, (the oApp_NewDocument calls the
oApp_DocumentOpen sub)

Opening a New doc from the template:
1. In my module it check's for a specific doc name, opening my template gets
Document1 - n that name is not unique so it fails, remember I don't want the
addin's modules to exec for any other template.

2. Since the Addin loads prior to the template.dot or it's new document1.doc
the module doesn't exec, if it does I get an error that there is no doc
open.

I tried adding a delay into the addin, but that only delays the addin from
finishing loading and eventually it fires prior to the template.dot or
document1.doc loading and with the tests for template name it fails to run
the module.

If I add a reference to my addin in the template and a Document_Open event

Private Sub Docuemnt_Open()
myTemplateProject.Auto_Start
End Sub

Set the security settings to low.

This works, I have a wrapper module called Auto_Start that checks a few
things prior to running, like reading the server name and SQL sProc from an
ini file, getting the database name etc...

Setting the security back to Med., now I'm prompted that the doc contains
macros, Arrrghh!

Any help would be appreciated.

JeffP.....
Cindy M.
2006-10-26 09:45:50 UTC
Permalink
Hi ***@Work,

Why wouldn't you put all your code in the template for these specific kinds of
documents? Why have any in an external Add-in at all?

Have you considered signing the VBA project in the template with a digital
signature? Or placing it in a trusted location? That should prevent any message
from coming up with security at med.
Post by "" <jpgmt_at_sbcglobal_dot_net>
I need my addin's modules to exec for only a specific template, so placing
the code that calls that template works, but not with Med security settings,
perhaps there's a way around this?
The macros work when manually executed, I have an automated process that
prints doc's w/little or no user intervention, similar to right-clicking on
a template and selecting Print.
My first attempt I put code into the special template that called the module
in the addin and all was fine and dandy.
This fine & dandy setup, ONLY works when security is set to Low, so I tried
to implement oApp_DocumentOpen in ThisDocument, and call my module, but that
fails to execute because of two reasons, (the oApp_NewDocument calls the
oApp_DocumentOpen sub)
1. In my module it check's for a specific doc name, opening my template gets
Document1 - n that name is not unique so it fails, remember I don't want the
addin's modules to exec for any other template.
2. Since the Addin loads prior to the template.dot or it's new document1.doc
the module doesn't exec, if it does I get an error that there is no doc
open.
I tried adding a delay into the addin, but that only delays the addin from
finishing loading and eventually it fires prior to the template.dot or
document1.doc loading and with the tests for template name it fails to run
the module.
If I add a reference to my addin in the template and a Document_Open event
Private Sub Docuemnt_Open()
myTemplateProject.Auto_Start
End Sub
Set the security settings to low.
This works, I have a wrapper module called Auto_Start that checks a few
things prior to running, like reading the server name and SQL sProc from an
ini file, getting the database name etc...
Setting the security back to Med., now I'm prompted that the doc contains
macros, Arrrghh!
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)
"" <jpgmt_at_sbcglobal_dot_net>
2006-10-26 14:08:38 UTC
Permalink
Cindy, you may see my inline. JeffP....
Post by Cindy M.
Why wouldn't you put all your code in the template for these specific kinds of
documents? Why have any in an external Add-in at all?
JeffP: Because I was trying to overcome the Med security and I was hoping
that by putting the cmds in an addin I could leave the template void of
macros.
Post by Cindy M.
Have you considered signing the VBA project in the template with a digital
signature? Or placing it in a trusted location? That should prevent any message
from coming up with security at med.
JeffP: I have considered it, but I need more reading on the subject on how
to implement.

However, I have another issue although I have the PsuedoNew/Open working
when I open the template, I get an hr glass for nearly 2 seconds before my
SQL data is refreshed, however if I run my clearFields macro, and then just
the UpdateFields macro it only takes a moment to re-query the SQL data and
refresh the fields, it appears that something is hanging....

To attempt a cure, I exported all the modules, recompiled, saved and
imported them back in, still the long pause on a fresh opening.
--------------
Post by Cindy M.
Post by "" <jpgmt_at_sbcglobal_dot_net>
I need my addin's modules to exec for only a specific template, so placing
the code that calls that template works, but not with Med security settings,
perhaps there's a way around this?
The macros work when manually executed, I have an automated process that
prints doc's w/little or no user intervention, similar to right-clicking on
a template and selecting Print.
My first attempt I put code into the special template that called the module
in the addin and all was fine and dandy.
This fine & dandy setup, ONLY works when security is set to Low, so I tried
to implement oApp_DocumentOpen in ThisDocument, and call my module, but that
fails to execute because of two reasons, (the oApp_NewDocument calls the
oApp_DocumentOpen sub)
1. In my module it check's for a specific doc name, opening my template gets
Document1 - n that name is not unique so it fails, remember I don't want the
addin's modules to exec for any other template.
2. Since the Addin loads prior to the template.dot or it's new document1.doc
the module doesn't exec, if it does I get an error that there is no doc
open.
I tried adding a delay into the addin, but that only delays the addin from
finishing loading and eventually it fires prior to the template.dot or
document1.doc loading and with the tests for template name it fails to run
the module.
If I add a reference to my addin in the template and a Document_Open event
Private Sub Docuemnt_Open()
myTemplateProject.Auto_Start
End Sub
Set the security settings to low.
This works, I have a wrapper module called Auto_Start that checks a few
things prior to running, like reading the server name and SQL sProc from an
ini file, getting the database name etc...
Setting the security back to Med., now I'm prompted that the doc contains
macros, Arrrghh!
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)
Loading...