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 / January 2007

Tip: Looking for answers? Try searching our database.

How to call a Word VBA subroutine from a Global Template?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul J - 26 Jan 2007 21:15 GMT
I have created some Word templates which contain several VBA macros
(sub/function) in common.

In order to make maintenance easier I have created a Global Template and
moved the VBA code in from the original templates.

Having added the Global Template to the current Word session (using Tools,
Templates and Add-Ins) I am now ready to call these subroutines from the
original templates.

I have spent nearly 10 hours researching this question today, so it is with
some humility that I must now ask:
- how, within a VBA subroutine, do you register the availability of the
Global Templates?
- how do you then call a subroutine from a Global Template?

Your help would be very much appreciated.
Paul J
Shauna Kelly - 27 Jan 2007 02:20 GMT
Hi Paul

> - how, within a VBA subroutine, do you register the availability of the
> Global Templates?

Open the global template. In the VBE, in the Project Explorer, right-click
your file (it probably says "Template project") and give it a useful name.
Save. Close.

Open the template. In the VBE, use Tools > References to create a reference
to the add-in. It will be listed under the name you gave it.

> - how do you then call a subroutine from a Global Template?
Call the function as, eg, x=MyAddin.MyFunction

> I have spent nearly 10 hours researching this question today,
Next time you have a problem like this, search the google groups archive at
http://groups.google.com.au/advanced_search?hl=en
A search for 'call subroutine from Global Template' with the group set to
microsoft.public.word.* gets your answer in a flash.

Hope this helps.

Shauna Kelly.  Microsoft MVP.
http://www.shaunakelly.com/word

>I have created some Word templates which contain several VBA macros
> (sub/function) in common.
[quoted text clipped - 15 lines]
> Your help would be very much appreciated.
> Paul J
Paul J - 27 Jan 2007 10:37 GMT
Please accept my gratefull thanks, Shauna.

> Hi Paul
>
[quoted text clipped - 41 lines]
> > Your help would be very much appreciated.
> > Paul J
 
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.