Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

Contol when an Addin Execs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JeffP@Work - 25 Oct 2006 09:18 GMT
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. - 26 Oct 2006 10:45 GMT
Hi JeffP@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.

> 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,
[quoted text clipped - 40 lines]
> 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 :-)
JeffP@Work - 26 Oct 2006 15:08 GMT
Cindy, you may see my inline.  JeffP....

> Hi JeffP@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?

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.

> 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.
--------------
>> I need my addin's modules to exec for only a specific template, so
>> placing
[quoted text clipped - 62 lines]
> reply
> in the newsgroup and not by e-mail :-)

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.