Checkbox VB code stopped working

Started by jdw_uk, July 04, 2016, 03:14:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jdw_uk

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


jdw_uk

Forgot to state version ... Visio 2013

jdw_uk

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?