Is there any such thing as a custom Word property?

C

Colin Steadman

I have a template that connects to a database in order to produce and
automated quote.

The user is likely to print the finished quote and then request
another. Because of this I need to store their username and password
somewhere between quotes. I have therefore written an AntoNew macro
to get username and password when the template is first opened.

Once the template is open, nothing happens until the user clicks a
quote button. When the quote button is clicked the main macro needs
the username and password in order to connect to the database.

The problem I have is that I dont know how to store the username and
password within Word between getting it from the user and the user
clicking the quote button.

Any ideas? I've toyed with encrypting it and storing it in the
registry, but I'd much rather have word store it somewhere and avoid
the registry altogether. Can this be done? Is it possible to create
a custom property within a Word document for this kind of thing?

TIA,

Colin
 
J

Jean-Guy Marcil

Colin Steadman was telling us:
Colin Steadman nous racontait que :
I have a template that connects to a database in order to produce and
automated quote.

The user is likely to print the finished quote and then request
another. Because of this I need to store their username and password
somewhere between quotes. I have therefore written an AntoNew macro
to get username and password when the template is first opened.

Once the template is open, nothing happens until the user clicks a
quote button. When the quote button is clicked the main macro needs
the username and password in order to connect to the database.

The problem I have is that I dont know how to store the username and
password within Word between getting it from the user and the user
clicking the quote button.

Any ideas? I've toyed with encrypting it and storing it in the
registry, but I'd much rather have word store it somewhere and avoid
the registry altogether. Can this be done? Is it possible to create
a custom property within a Word document for this kind of thing?

For something like this I would use Document Variables because they are
invisible to the user and can only be modified through VBA.

ActiveDocument.Varibales("UserName").Value = "MyName"

See the online help for more details.

Otherwise, yes, you can create custom properties. Look up the
DocumentProperty Collection or the Add method as it applies to custom
document properties.

--

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