STORING VARIABLES UNTIL YOU CLOSE WORD

J

Joey Jacobs

I store values in a Access database (company details) and
want to use it throughout word but I do not want to use:

activedocuments.variables.add Name:=CompName Value:=CoName

Obviously activedocument isn't open as yet when you open
word and it must also be available when you create new
documents.

I have tried the option abovementioned as well as:

Thisdocument.variables.add etc

but to no avail. Tried placing it in the AutoNew, AutoExec
etc. macros but no go. I use the whole template as an add
in. All the above options work but not as well as I want
it to.

What I am trying to find out if it is possible to use a
program variable or field instead of a docvariable or
perhaps the registry entry but word must keep the values
until you exit word.
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Joey Jacobs > écrivait :
In this message, < Joey Jacobs > wrote:

|| I store values in a Access database (company details) and
|| want to use it throughout word but I do not want to use:
||
|| activedocuments.variables.add Name:=CompName Value:=CoName
||
|| Obviously activedocument isn't open as yet when you open
|| word and it must also be available when you create new
|| documents.
||
|| I have tried the option abovementioned as well as:
||
|| Thisdocument.variables.add etc
||
|| but to no avail. Tried placing it in the AutoNew, AutoExec
|| etc. macros but no go. I use the whole template as an add
|| in. All the above options work but not as well as I want
|| it to.
||
|| What I am trying to find out if it is possible to use a
|| program variable or field instead of a docvariable or
|| perhaps the registry entry but word must keep the values
|| until you exit word.

What do you plan to do with this info once it is stored?
I mean, how are you planning to use it during the Word session?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Joey Jacobs

Hi, thanx for responding.
I have a company name, address, contact details, etc and
lots more other details in a database. I have written a
document assembly package in VBA and I insert certain
documents into others wanting to use the data from the
database e.g. the document will say ... I, the undersigned
[Name] do hereby make oath and say that: (1) I am a
director of [CompanyName]. (2) Our head office is situate
at [CompanyAddress] so the details in [] must pull through
into various word documents. So those variables must stay
assigned to something so that it can be used. It will be
the same for each company where this is running. This will
differ from client to client and therefore I cannot hard
code it in VBA as the maintenance part of it would be huge
and whenever an update comes out then I need to update
everyone individually. Hope you understand what I'm trying
to do.
 
J

Jeff

Have you tried using privateprofilestrings. Because the exploit Windows INI
file protocols they are easy to deal with and efficient in execution
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Joey Jacobs > écrivait :
In this message, < Joey Jacobs > wrote:

| Hi, thanx for responding.
| I have a company name, address, contact details, etc and
| lots more other details in a database. I have written a
| document assembly package in VBA and I insert certain
| documents into others wanting to use the data from the
| database e.g. the document will say ... I, the undersigned
| [Name] do hereby make oath and say that: (1) I am a
| director of [CompanyName]. (2) Our head office is situate
| at [CompanyAddress] so the details in [] must pull through
| into various word documents. So those variables must stay
| assigned to something so that it can be used. It will be
| the same for each company where this is running. This will
| differ from client to client and therefore I cannot hard
| code it in VBA as the maintenance part of it would be huge
| and whenever an update comes out then I need to update
| everyone individually. Hope you understand what I'm trying
| to do.

Your best bet would be to go the page posted by Chad.

There, look at the AutoText entries, Setting files and Windows registry
sections. Pick the one you want.
Remember that you will have to include some code that will allow the user to
update this stuff, or have code in your Database that will automatically
update these values so that when Word calls thenm they are always accurate.
Keeping this in mind, the easiest would probably be the registry...
(depending on your database set up).

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top