![]() |
#1
|
|||
|
|||
![]()
+++ EDIT: decided to provide additional detail in hopes of a response +++
I have an add-in that needs to persistently store a few variables between Word "sessions". I would much prefer to do this in one totally encapsulated .dotm; meaning storing of the variables within the add-in file itself. As far as I can figure, my options are to either use document properties or document variables. Since properties can easily be stripped, I decided to use document variables. Everything worked just fine as long as I tested with a .docx. However, upon conversion to .dotm and storing in the Word startup folder, I ran into the problem that the .dotm technically does not get opened as a global template and therefore the document variables don't seem to be available via "ActiveDocument.Variables(...)" when executing some add-in code via the AutoExec macro. So, here are my questions: (a) Am I on the right track w/ the use of document variables or would you suggest a different solution? (b) What's the way to read/write from/to the variables in the .dotm. (c) It seems to me that the document properties would have the same issue if I would have gone that route. Thanks for your help. Last edited by chrismad; 04-23-2014 at 08:45 PM. Reason: More detail |
#2
|
||||
|
||||
![]()
If you're running the code from the template, simply change "ActiveDocument.Variables(...)" to "ThisDocument.Variables(...)".
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Been a while but... Thank you this solved it.
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Same values of variables in word add-in are being shared across multiple document | naq.abbas@gmail.com | Word | 0 | 01-13-2014 10:41 AM |
![]() |
kenglade | Word | 3 | 12-19-2011 04:00 PM |
![]() |
webharvest | Word VBA | 5 | 06-21-2011 03:22 PM |
![]() |
Aiken_Bob | Word | 4 | 05-02-2011 02:41 PM |
Envelopes with Document Variables | mailtobln | Word | 0 | 02-11-2009 10:48 PM |