Visio Guy

Visio Discussions => Programming & Code => Topic started by: jdw_uk on July 04, 2016, 03:14:53 PM

Title: Checkbox VB code stopped working
Post by: jdw_uk on July 04, 2016, 03:14:53 PM
Hi,

I have a Visio diagram with multiple layers.

In Developer mode I have added some checkboxes to the page to enable [make visable] these layers.

Sample code below:

Private Sub CheckBox1_Click()
Dim LayersObj As Visio.Layers
Dim LayerObj As Visio.Layer
Dim LayerName As String
Dim LayerCellObj As Visio.Cell
Set LayersObj = ActivePage.Layers
For Each LayerObj In LayersObj
LayerName = LayerObj.Name
' Debug.Print LayerName
  If LayerName = "User-to-BE" Then
    Set LayerCellObj = LayerObj.CellsC(visLayerVisible)
'LayerCellObj.Formula = False Or 0
  If LayerCellObj.Formula = False Or 0 Then LayerCellObj.Formula = True Or 1 Else LayerCellObj.Formula = False Or 0
      End If
Next
End Sub


There is nothing wrong with the code as it does want i want. The problem is that the checkbox function has stopped working.

For example when I click the checkbox Visio no longer makes the layer visible. This happened after a SAVE > EXIT , then re-open.

If I send to a friend's PC it works fine for him, which means it must be something local to my Visio settings.

I have checked the 'Macro Security' settings are the same as my friends PC.

Please help!

JDW

Title: Re: Checkbox VB code stopped working
Post by: jdw_uk on July 04, 2016, 03:16:46 PM
Forgot to state version ... Visio 2013
Title: Re: Checkbox VB code stopped working
Post by: jdw_uk on July 05, 2016, 09:01:52 AM
Found the problem!

I needed to delete temporary files, in particular this file [i think!] :

C:\Users\jdw\AppData\Local\Temp\MicrosoftVisio15\MSForms.exd

Does anyone know what is going on here?