Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 10-02-2014, 04:30 PM
gmaxey gmaxey is offline Show/Hide Text based on Checkbox Selection Windows 7 32bit Show/Hide Text based on Checkbox Selection Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

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.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show/Hide Text based on Checkbox Selection Hide/Unhide a Block of Text Based on Choice Selection inquirer Word VBA 7 09-22-2014 04:41 PM
Show/Hide Text based on Checkbox Selection Hide Checkbox When Printing vinceplunkett Word 1 12-03-2013 01:53 AM
Show/Hide Text based on Checkbox Selection Show/hide paragraphs based on upfront decisions miscia76 Word 1 11-13-2013 04:29 PM
Show/Hide Text based on Checkbox Selection 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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:37 PM.


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