PDA

View Full Version : Word Template Add-In Not Firing



geekgirlau
05-23-2008, 04:55 PM
I've posted the details here (http://www.tek-tips.com/viewthread.cfm?qid=1475552&page=1).

Tony and Gerry have both already contributed to this question, leaving me 99% sure that I already know the answer to this one. But being an eternal optimist, I try again!

Brilliant solutions and workarounds sought!

fumei
05-26-2008, 11:11 AM
Well if you do find a way, please let us know!

Here, we have disabled using Word as the email editor. We do not allow Word to be the mail editor. More pain that it is worth.

However, as to your problem, I find it interesting that the instance of Word created by Outlook (so it can be used as the editor) by-passes Startup (and thus your global template). Seems a flaw to me.

Ummmm, which Startup is it in? The username Startup, or the Program Files Startup?

I wonder if it would make a difference.

I do not think any of the startup switches for Outlook itself will help.

geekgirlau
05-26-2008, 03:52 PM
What's weird is that you can see a temporary file for the global template, suggesting that the template file is indeed loaded, but no code is triggered. I ran a test with a message box in Document_New, Document_Open and also the good old AutoExec - nothing.

I couldn't see any startup switch for Outlook that looked relevant - thanks for the suggestion though.

My client wants to use Word as the email editor, so I'm going to recommend that they add Word to their startup so that it is loaded prior to Outlook, which should bypass the problem.

fumei
05-27-2008, 09:42 AM
"What's weird is that you can see a temporary file for the global template"

Explain this please. See it where?

I am not quite following. Which Document_New? If your global is indeed loaded, why would a Document_New be fired from it? If it is a global you would not normally be cerating documents from it.

Does the global show as loaded when Outlook makes its instance?

geekgirlau
06-02-2008, 12:01 AM
Ok, let's assume that my Startup path is set to C:\Startup. Within this folder is the template "Test.dot".

When you open Outlook (with Word set as the email editor), the following temporary file is created: C:\Startup\~$st.dot. I can't really test to see that it's loaded, as the only method I know is to open Word (which loads the template anyway), however the existence of this temporary file seems to indicate that it has loaded.

My test of the events (Document_New and Document_Open) was to see if any of these are fired when you load the template (I didn't actually anticipate success with either of these). However AutoExec doesn't fire either, although normally this WOULD be triggered when the template is loaded, and Word doesn't have a huge number of document events to choose from.

So I guess what I'm really looking for is a foolproof method to trigger a macro when Outlook loads an instance of Word.

fumei
06-02-2008, 11:18 AM
I do not know of a way, but just for fun...no, never mind. I was thinking of testing with a winword.exe startup switch. But that most likely would not work, as Outlook is (I think) making an instance of Word all on its own.

I am inclined to think this is simply not possible.

I find it very odd that a temp file (~$st.dot) is made, but an AutoExec there does not fire. But then, as you have pointed out Word itself is not opened. It is like Outlook makes a hidden (partial?) instance...sort of.

I think you are stuck on this one.

qazpl
06-02-2008, 02:05 PM
How about a com addin in vb6 it only takes about two minutes to make and the code is nearly the same

fumei
06-02-2008, 02:21 PM
Huh? What do you mean????

What would a COM addin do for this?

How on earth can you say the code "is nearly the same"...when you have not seen any code!?

Nor has any code been posted! Nearly the same.....as what??? You have not seen any.

qazpl
06-02-2008, 02:55 PM
I am assuming that addins do get triggered. com addin has the same object model and events as vba meaning the syntax for vba rarely needs to be changed. it is actually simpler to create startup code in addin. if you want example instruction just ask.

geekgirlau
06-02-2008, 08:02 PM
Thanks for the suggestion - I'll have to dust off my VB skills and give this a try.

fumei
06-03-2008, 08:49 AM
"I am assuming that addins do get triggered. "

That may be, in fact, an incorrect assumption. A global template - which is the case here - IS an add-in. And apparently its automatic events are NOT being triggered.

Do you know for a fact that a COM addin is loaded when Outlook makes this instance of Word? Since my Outlook does not load Word, I can not test this.

You are certainly correct that making a wee COM (a DLL really) in VB would be a good test. Essentially you could put one procedure...a Document_Open event for example. Anything that would indicate its procedures ARE accessible. However, not just accessible, but that automatic events ARE being executed. The point being is that Outlook appears to creating an special instance of Word that does NOT fire the normal starting Word events.

So...would a DLL (your COM object) work? Frankly, I do not know. I have my doubts, but the only way to really know - unless you tell me that you have actually done this - would be to actually check and see.

The reason I have my doubts is this thing with the temp file for what should be loaded, i.e. the global template in Startup. It seems to be loaded (there is the temp file for it), but apparently its automatic events are NOT be fired.

I wish I could test this. Geekgirlau, do you access to VB in order to write a wee COM?

geekgirlau
06-10-2008, 03:37 PM
Yes - I'll give this a shot when I have a moment and report back (curious myself, although not optimistic)