Is there a way to store data not meant to be printed only accesed by vba macros in a word document

I have many word documents that connect to  sqlite databases is it possible to store the database path somewher in the document where it is not visible to the user that a vba macro can read to connect to the database?
Who is Participating?
kmslogicConnect With a Mentor Commented:
Yes, you can use document variables in VBA:

ActiveDocument.Variables.Add Name:="MyComments", Value:="This is some stuff that gets stored with the document."

Open in new window

Then you can retrieve it with


Open in new window

Dov_BAuthor Commented:
Thanx a kazillion!
how much text can be stored in a document variable?
Is it possible to stor an sqlite database file in a document variable?
It looks like the limitation is 65k characters for a single variable in Word 2013 (not sure about earlier versions).  So embedding a sqllite database might be challenging but perhaps not impossible if you use many variables to hold the values and then reconstruct it in VBA.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.