Hidden Form Fields

C

Chris

Hi

I've created a macro that loads various drop down lists from a database.

I need to include a hidden field in the document so i can store for example
the selected item's id.

How do i create a hidden field in a word document?
Thanks for you help

Chris
 
J

Jean-Guy Marcil

Bonjour,

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

|| Hi
||
|| I've created a macro that loads various drop down lists from a database.
||
|| I need to include a hidden field in the document so i can store for
example
|| the selected item's id.
||
|| How do i create a hidden field in a word document?
|| Thanks for you help

I wouldn't... If you rely on that in to run the code later, the user may
have inadvertently deleted it..

Use document variables. Look up "Variables" in the Word VBA help, there are
numerous examples there to get you going... Some people prefer working with
custom document properties, but those can also be modified by the user.
Document variables are only accessible through VBA.

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

Peter Hewett

Hi Chris

Normally Document Variables are used for storing data you don't want to actually appear in
the document. You can use fields but they can be deleted. You can create a document
variable like this:
ActiveDocument.Variables("Mydocvar").Value = "The data to store"

and retrieve it like this:
MsgBox ActiveDocument.Variables("Mydocvar").Value

HTH + Cheers - Peter
 

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