Storing extra information in a Word document.

J

John... Visio MVP

Now that the new Office format is now a directory structure with a zip file,
is it possible within VBA to read/write information to a file within the
"zip" file. Currently I am using the registry to store information, but if I
can keep it within the Word document, the information would be more
portable.

John... Visio MVP
 
D

Doug Robbins - Word MVP

You have always been able to store information in a document by the use of a
document variable

ActiveDocument.Variables("VariableName").Value = "This message will be
stored in the document variable named VariableName")

To retrieve the information, you just put the
ActiveDocument.Variables("VariableName").Value on the other side of the =

Dim X as String

X = ActiveDocument.Variables("VariableName").Value

Then,

MsgBox X

will display

This message will be stored in the document variable named VariableName"

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

John... Visio MVP

Doug Robbins - Word MVP said:
You have always been able to store information in a document by the use of
a document variable

ActiveDocument.Variables("VariableName").Value = "This message will be
stored in the document variable named VariableName")

To retrieve the information, you just put the
ActiveDocument.Variables("VariableName").Value on the other side of the =

Dim X as String

X = ActiveDocument.Variables("VariableName").Value

Then,

MsgBox X

will display

This message will be stored in the document variable named VariableName"

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP



Thanks Doug.

Playing with the ribbon, peaked my curiosity as to what else could be done.
For some reason, I never really considered document variables as anything
more than transitory. Time for some more playing. ;-)

John... Visio MVP
 
C

Cindy M.

Hi John,
Now that the new Office format is now a directory structure with a zip file,
is it possible within VBA to read/write information to a file within the
"zip" file. Currently I am using the registry to store information, but if I
can keep it within the Word document, the information would be more
portable.
More "modern", and more flexible, than document variables are CustomXMLParts.
What's more, these are going to be present across Office (they're already in
Excel, as well). These are separate XML files within the ZIP file, so you can
exchange them or extract them quickly and easily, as well as working with them
through the object model.

In addition, in Word a Custom XML Part can be bound to a number
of ContentControl types so that the content of the XML is displayed in the
control, and whatever the user types into the control is written to the XML.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
J

John... Visio MVP

Cindy M. said:
Hi John,

More "modern", and more flexible, than document variables are
CustomXMLParts.
What's more, these are going to be present across Office (they're already
in
Excel, as well). These are separate XML files within the ZIP file, so you
can
exchange them or extract them quickly and easily, as well as working with
them
through the object model.

In addition, in Word a Custom XML Part can be bound to a number
of ContentControl types so that the content of the XML is displayed in the
control, and whatever the user types into the control is written to the
XML.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)


This reply is posted in the Newsgroup; please post any follow question or
reply
in the newsgroup and not by e-mail :)

More reading to do. Thanks for the information for a new area to explore.

John... Visio MVP
 

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