Hi Larry
1. I'm not aware of any hash table capability in VBA, but others may chime
in and point something out.
2. A public function that returns the info seems like as good an idea as
any.
3(a) You can call a function in an add-in (ie a .dot file loaded through
Tools > Templates and Add-ins or, easier, loaded automatically when Word
starts if you put it in Word's startup folder) from any template or another
add-in. In the VBE, use Tools > References to create a reference to the
add-in. Then call the function as, eg x=MyAddin.MyFunction
3(b) It depends on (a) how non-techie the non-techie people are, (b) how
much data you have and (c) how strict you want the user interface to be,
preferably without having to write one!
For this kind of thing, depending on the circumstances, you might try:
- An old-fashioned .ini file (look up PrivateProfileString in VBA help).
Disadvantage: No error checking for the user; must use Notepad or some such
to edit unless you'd like to write a UI.
- An Excel file. You can get at the data in several ways. The slow way is to
open Excel and open the file (see
http://www.word.mvps.org/FAQs/InterDev/ControlXLFromWord.htm). A fast way
for read-only is to use DAO (see
http://www.word.mvps.org/FAQs/InterDev/XLToWordWithDAO.htm). Advantage: The
non-techie gets the existing Excel user interface with all the bells and
whistles of protection, data validation, conditional formatting etc that you
care to create. Create the data either with an old-fashioned dynamic range
(see http://www.contextures.com/xlNames01.html) or in one of the new Data
Lists so the range name grows automatically as the user adds data.
- An XML file editable in Word. You can get at the data using MSXML (set a
Reference to it in the VBE). For the user to edit it in Word, you'll need to
create an XSD, add it to the Schema Library, and teach the non-techie how to
tag text to create a new record and how to save it as an .XML file (not a
.doc file), or write some code to do it.
- A Word file, possibly the add-in. Put the data in a table, and give the
users strict instructions on how to complete it. Technically, this will
work, but the advantages of the built-in mechanisms in the UI in Excel
outweigh Word for something like this in my experience.
I use Excel files a lot for this kind of thing, where (by database
standards) there's very little data, and you want a non-techie to edit it. I
recently had good experience with an XML file to be edited in Word, but I
think that depends on the audience.
By the way, I assume you do know about Tools > Options > Compatibility >
Font Substitution. I hope you're not reinventing a wheel here!
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
> Hi! I have a Word (2003) template that, among other things, maps
> typefaces from nice fancy ones to roughly equivalent plain everyday
[quoted text clipped - 62 lines]
>
> End Sub
larrysulky@gmail.com - 17 Sep 2006 17:02 GMT
---BIG SNIP OF REALLY VALUABLE INFO---
Thanks so much, Shauna -- I was missing the step of adding the template
project as a reference! Just being able to call the function from an
add-in will be good enough for now...a big improvement.
I knew a bit about the automatic font substitution, but this stuff has
to go well beyond that, and in a controlled method for what we're
doing.
Thanks again!
--larry
Shauna Kelly - 18 Sep 2006 11:38 GMT
Larry
I'm glad it helped.
Shauna
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
> ---BIG SNIP OF REALLY VALUABLE INFO---
>
[quoted text clipped - 8 lines]
> Thanks again!
> --larry