Hi All,

New to the forum and VBA, so looking for some help.

I have a drawing in visio with multiple layers, and I am trying to insert a word into an excel cell depending on which layers are active. The code I've put into the excel VBA is as follows:

Sub UpdateOptions()

    Dim VisApp As Object
    Dim VisDoc As Visio.Document

    Set VisApp = GetObject(, "Visio.Application")
    With VisApp
        .Windows("Document").Activate
        If ActiveDocument.Pages(Model).checkLayerSetting("Option02", conVisible) = True Then
            Range("E8").Value = "Yes"
        End If
    End With

End Sub
This is cannabalised from some code I have working from visio, looking at the value of a cell in the same excel fine, which seems to work fine.

The problem is I am getting a runtime error "Type Mismatch" from the line in red.

Any advice?
Thanks in advance