Discussion:
How do I share my VBA code across all my MS Office applications, programs, & documents?
(too old to reply)
M***@Alum.MIT.Edu
2006-01-29 01:57:00 UTC
Permalink
I'm a VBA newbe. And it seems VBA code is generally stored in a
particular MS Office document (.xls, .mdb, etc) and only accessible
within that document (as in Access) or within that program (as Excel).

** How do I share my VBA code between all my MS Office applications
(Word, Access, Excel, Outlook, etc) and cause it to be automatically
loaded when the applications start? For instance, sharing a badly
needed GMT() function which returns the current time in GMT.

In particular, I'm putting together some GMT & UTC date functions
(based on www.cpearson.com/excel/timezone.htm), plus certain standard
file naming & label generation, which I'd like all my applications to
have applications to have access to. I've thought of add-ins, but
these SEEM to be tied to particular applications (as letter.dot for
Word, .mda for Access, etc).

Thanks! PS: Give your paypal email and I'll send you some $ for a good
answer!
-Mike Parker, www.Cytex.com
Wolfgang Kreuzer
2006-01-29 05:02:22 UTC
Permalink
If you have VB6 (which I use) or VC or ... you can create your own
common library which contains whatever you like.

In VB I created an ActiveX COM DDL which contains several class modules
e.g. clsFileFunctions, clsDateTime ... each having the property
Instancing set to GlobalMultiUse. This allows you to use your
subs/functions whereever you like without explicitely creating an
instance, provided you put a reference to your DLL in the project.

For details I would recommend to dig into a book which covers classes
and compatibility of classes (I could recommend german one's only).
This topic comes into play when you need to change definitions of your
methods - I haven't (at first instance), which caused me headaches (and
a lot of recompiling).

HTH

Wolfgang
Thomas Möller
2006-01-29 08:23:30 UTC
Permalink
Hi Wolfgang,
Post by Wolfgang Kreuzer
For details I would recommend to dig into a book which covers classes
and compatibility of classes (I could recommend german one's only).
I'm interested in this books. Can you please tell me the title's

TIA
--
Thomas

Homepage: www.Team-Moeller.de
Wolfgang Kreuzer
2006-01-29 09:10:48 UTC
Permalink
By the way, one of my book is available in english as well:
- Hardcore Visual Basic 5.0; Bruce McKinney; Microsoft Press; to my
knowledge out of print - available in internet - try
http://vb.mvps.org/hardcore/; very good, but real hard stuff for
beginning with

German books
- Visual Basic 6 Kompendium; Peter Monadjemi; Markt+Technik; ISBN
3-8272-6601-7;
book is ok, was the only one I found in my book store when I started
with VB

- Visual Basic 6 Programmiertechniken, Datenbanken, Internet; Michael
Kofler; Addison-Wesley; ISBN 3-8273-1428-3; I prefer it to the last
one, is more exact in some areas

Loading...