![]() |
|
#8
|
|||
|
|||
|
Part of your problem is you are deleting variables by setting them equal to ""
Demo: Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey With ActiveDocument .Variables("Test").Value = "Test" MsgBox "This document contains: " & .Variables.Count & " variable" 'Setting a name variable value to "" deletes the variable .Variables("Test").Value = "" On Error Resume Next MsgBox ActiveDocument.Variables("Test").Value MsgBox "This document contains: " & .Variables.Count & " variables" End With End Sub You need to have something in the variable even if it is just " " If you look at the code in Graham's example, you will see that is what he did Yes, provide other users allow macros to run in their documents, if you set up this way then it should work for everyone. |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Hide/Unhide a Block of Text Based on Choice Selection
|
inquirer | Word VBA | 7 | 09-22-2014 04:41 PM |
Hide Checkbox When Printing
|
vinceplunkett | Word | 1 | 12-03-2013 01:53 AM |
Show/hide paragraphs based on upfront decisions
|
miscia76 | Word | 1 | 11-13-2013 04:29 PM |
VBA for CheckBox to Hide Slides
|
mutchy25 | PowerPoint | 1 | 09-21-2012 01:40 AM |
| Macro to populate a text form field based on dropdown selection | koloa | Word | 0 | 10-20-2011 11:52 AM |