Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-23-2014, 03:35 PM
chrismad chrismad is offline Document Variables in .dotm Windows 7 64bit Document Variables in .dotm Office 2013
Novice
Document Variables in .dotm
 
Join Date: Apr 2014
Posts: 5
chrismad is on a distinguished road
Default Storing of variables in add-in

+++ 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
Reply With Quote
  #2  
Old 04-25-2014, 06:21 PM
macropod's Avatar
macropod macropod is offline Document Variables in .dotm Windows 7 32bit Document Variables in .dotm Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,369
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

If you're running the code from the template, simply change "ActiveDocument.Variables(...)" to "ThisDocument.Variables(...)".
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-08-2014, 06:02 PM
chrismad chrismad is offline Document Variables in .dotm Windows 7 64bit Document Variables in .dotm Office 2013
Novice
Document Variables in .dotm
 
Join Date: Apr 2014
Posts: 5
chrismad is on a distinguished road
Default

Been a while but... Thank you this solved it.
Reply With Quote
Reply



Similar Threads
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
Document Variables in .dotm New template/New normal.dotm kenglade Word 3 12-19-2011 04:00 PM
Document Variables in .dotm Update bookmarks and variables in document webharvest Word VBA 5 06-21-2011 03:22 PM
Document Variables in .dotm How to get to normal.dotm Aiken_Bob Word 4 05-02-2011 02:41 PM
Envelopes with Document Variables mailtobln Word 0 02-11-2009 10:48 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:54 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft