Discussion:
How do I Call an Addin's methods from a template?
(too old to reply)
"" <jpgmt_at_sbcglobal_dot_net>
2006-10-12 16:05:53 UTC
Permalink
If I have one addin and I want to have add specific ADO SQL query to just
ONE template dot, when this one dot is launched (via automated process, no
user intervention and off to the printer it goes) I want to know if and how
to access the methods in the addin from the dot?

How do I access the methods in the addin?

How do I make sure that the dot fires AFTER the addin's auto_exec?

I have an automated printing process that is launched from an app & DDE
server that will give me a recID to do my query.

There is one generic addin to support this process, I want to add code in
just one template to retrieve data not exposed by the application.

In a perfect world, the primary addin's auto_exec will fire establishing the
functions needed by the dot's ADO query.


TIA

JeffP...
Shauna Kelly
2006-10-13 11:56:11 UTC
Permalink
Hi Jeff
Post by "" <jpgmt_at_sbcglobal_dot_net>
Post by "" <jpgmt_at_sbcglobal_dot_net>
How do I access the methods in the addin?
There are three steps:

1. Open the add-in using File > New. In the VBE, in the project explorer,
right-click the name of the project (eg 'Template Project') and give it a
name. Save and close.

2. In your template, in the VBE, Tools > References. Set a reference to your
add-in.

3. In your template's code, use MyAddIn.MySubName
Post by "" <jpgmt_at_sbcglobal_dot_net>
Post by "" <jpgmt_at_sbcglobal_dot_net>
How do I make sure that the dot fires AFTER the addin's auto_exec?
I understand that prayer helps. Sprinkling DoEvents liberally in all code
helps a bit more. See the thread here for typical issues:
http://groups.google.com.au/group/microsoft.public.word.vba.general/browse_frm/thread/76c5724597d08ea2/3ece763790c6f330

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
Post by "" <jpgmt_at_sbcglobal_dot_net>
If I have one addin and I want to have add specific ADO SQL query to just
ONE template dot, when this one dot is launched (via automated process, no
user intervention and off to the printer it goes) I want to know if and
how to access the methods in the addin from the dot?
How do I access the methods in the addin?
How do I make sure that the dot fires AFTER the addin's auto_exec?
I have an automated printing process that is launched from an app & DDE
server that will give me a recID to do my query.
There is one generic addin to support this process, I want to add code in
just one template to retrieve data not exposed by the application.
In a perfect world, the primary addin's auto_exec will fire establishing
the functions needed by the dot's ADO query.
TIA
JeffP...
"" <jpgmt_at_sbcglobal_dot_net>
2006-10-13 17:50:25 UTC
Permalink
Shauna,

Re-reading the last cell re Addin
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/modcore/html/deovrworddocumenttemplatesvswordaddinsglobaltemplates.asp

I found setting a "Ref" and now I have the methods available to me.

I've added to my template....

In "ThisDoc..."

Option Expl....
----------------------------
Public Sub AutoOpen()
MyLocalModule.MySub
End Sub
----------------------------

Which MySub is a wrapper for anything that will happen in this template.

I also found DocProperty so I can assign my returned values from my SQL
query to merge fields w/in the doc.

It's not fully tested but it appears to be working.

My templates are printed by a "Print" cmd, w/no user interaction similar to
using a right-click |Print and pray that my fields are updated, SalesPeople
hate when their commision coding is done wrong.

TIA

JeffP....
Post by Shauna Kelly
Hi Jeff
Post by "" <jpgmt_at_sbcglobal_dot_net>
Post by "" <jpgmt_at_sbcglobal_dot_net>
How do I access the methods in the addin?
1. Open the add-in using File > New. In the VBE, in the project explorer,
right-click the name of the project (eg 'Template Project') and give it a
name. Save and close.
2. In your template, in the VBE, Tools > References. Set a reference to
your add-in.
3. In your template's code, use MyAddIn.MySubName
Post by "" <jpgmt_at_sbcglobal_dot_net>
Post by "" <jpgmt_at_sbcglobal_dot_net>
How do I make sure that the dot fires AFTER the addin's auto_exec?
I understand that prayer helps. Sprinkling DoEvents liberally in all code
http://groups.google.com.au/group/microsoft.public.word.vba.general/browse_frm/thread/76c5724597d08ea2/3ece763790c6f330
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
Post by "" <jpgmt_at_sbcglobal_dot_net>
If I have one addin and I want to have add specific ADO SQL query to just
ONE template dot, when this one dot is launched (via automated process,
no user intervention and off to the printer it goes) I want to know if
and how to access the methods in the addin from the dot?
How do I access the methods in the addin?
How do I make sure that the dot fires AFTER the addin's auto_exec?
I have an automated printing process that is launched from an app & DDE
server that will give me a recID to do my query.
There is one generic addin to support this process, I want to add code in
just one template to retrieve data not exposed by the application.
In a perfect world, the primary addin's auto_exec will fire establishing
the functions needed by the dot's ADO query.
TIA
JeffP...
Loading...