Discussion:
Calling functions in addins
(too old to reply)
Robert Andrews
2006-07-11 08:27:50 UTC
Permalink
Hi All,


I have a globall addin called abc.dot. This addin contains a function called
ProcessDocument.
i.e. Function ProcessDocument (docGeneratedDocument) as Boolean. The
function is located is a module called Master. Note that the same function
may exist in a different global template e.g. def.dot. The template is
loaded by an AutoOpen sub which is located in a template which is attached
to the document.

What happens is that the user attaches a template to document. The template
contains AutoOpen code and a reference to a global addin file. When the user
opens the document the autoopen function determines the global addin to load
from a variable within the template and then loads the appropriate addin.
Each global addin will contains a function called ProcessDocument.

So when I am coding the template to attach to the document I don't know what
global template I will be loading as the user can change this value in the
template.

At preset I call this function from attached template using WordBasic. ie.
Result = WordBasic.Call("Master.ProcessDocument", ActiveDocument). This
works correctly.

I was wondering if there is a way of doing this in native VBA without having
to call WordBasic?

Many thanks in advance for your help.
Cindy M -WordMVP-
2006-07-11 11:19:08 UTC
Permalink
Hi Robert,

you can *try* just plain Call (without WordBasic) or Application.Run.
Post by Robert Andrews
I have a globall addin called abc.dot. This addin contains a function called
ProcessDocument.
i.e. Function ProcessDocument (docGeneratedDocument) as Boolean. The
function is located is a module called Master. Note that the same function
may exist in a different global template e.g. def.dot. The template is
loaded by an AutoOpen sub which is located in a template which is attached
to the document.
What happens is that the user attaches a template to document. The template
contains AutoOpen code and a reference to a global addin file. When the user
opens the document the autoopen function determines the global addin to load
from a variable within the template and then loads the appropriate addin.
Each global addin will contains a function called ProcessDocument.
So when I am coding the template to attach to the document I don't know what
global template I will be loading as the user can change this value in the
template.
At preset I call this function from attached template using WordBasic. ie.
Result = WordBasic.Call("Master.ProcessDocument", ActiveDocument). This
works correctly.
I was wondering if there is a way of doing this in native VBA without having
to call WordBasic?
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 :-)
Robert Andrews
2006-07-11 23:54:26 UTC
Permalink
Thanks Cindy,
Application..Run did the trick.
Post by Cindy M -WordMVP-
Hi Robert,
you can *try* just plain Call (without WordBasic) or Application.Run.
Post by Robert Andrews
I have a globall addin called abc.dot. This addin contains a function called
ProcessDocument.
i.e. Function ProcessDocument (docGeneratedDocument) as Boolean. The
function is located is a module called Master. Note that the same function
may exist in a different global template e.g. def.dot. The template is
loaded by an AutoOpen sub which is located in a template which is attached
to the document.
What happens is that the user attaches a template to document. The template
contains AutoOpen code and a reference to a global addin file. When the user
opens the document the autoopen function determines the global addin to load
from a variable within the template and then loads the appropriate addin.
Each global addin will contains a function called ProcessDocument.
So when I am coding the template to attach to the document I don't know what
global template I will be loading as the user can change this value in the
template.
At preset I call this function from attached template using WordBasic. ie.
Result = WordBasic.Call("Master.ProcessDocument", ActiveDocument). This
works correctly.
I was wondering if there is a way of doing this in native VBA without having
to call WordBasic?
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...