Visio Guy

Visio Discussions => Programming & Code => Topic started by: anico on January 03, 2019, 09:45:48 PM

Title: Uncheck a checkbox with macro
Post by: anico on January 03, 2019, 09:45:48 PM
Hi there,

This is probably a simple fix. I have a several checkboxes on a sheet that are checked. In one of my macros, I want to un-check them.

I assumed the syntax for this was: Application.ActiveWindow.CheckboxName.Value = False

That throws an 'object does not support this property or method' error. How can I reference my checkbox to switch it off?
Title: Re: Uncheck a checkbox with macro
Post by: wapperdude on January 05, 2019, 03:49:15 AM
The checkbox isn't a Visio object, so your statement fails.  I believe the following ought to work:


Dim visOle As Visio.OLEObject
Dim visCkBox As Visio.Shape

Set visOle = ActivePage.OLEObjects(visCkBox.Name)
visOle.Object.value = False


HTH
Wapperdude
Title: Re: Uncheck a checkbox with macro
Post by: anico on January 07, 2019, 01:11:44 PM
Took me a minute to figure out the checkbox name has to be in quotes, but this works perfect. Thanks!