lsygo

How to extract symbol properties using VBA?

Discussion created by lsygo on Jan 24, 2012
Latest reply on Jan 25, 2012 by Neil
I am writing a VBA program to extract symbol properties under feature layers of a MxDocument.
I'm able to extract properties like symbol colors and line width, but when I try to get more detail,
I'm not able to tell whether a symbol is SimpleLineSymbol or MarkerLineSymbol.
My program is like this:


Dim pGFL As IGeoFeatureLayer
Dim pSbl As ISymbol
Dim pSPR As ISimplyRenderer
Dim pMLS As IMarkerLineSymbol

If TypeOf pGFL.Renderer Is ISimpleRenderer Then
    Set pSPR = pGFL.Renderer

    If pFL.FeatureClass.ShapeType = esriGeometryPolyline Then
        Set pMLS = pSbl
        MsgBox "Marker Symbol Size = " & pMLS.MarkerSymbol.Size
    End If
End If


But I got error when I came over Set pMLS = pSbl.
If I define pMLS as MarkerLineSymbol instead of IMarkerLineSymbol, the statement Set pMLS = pSbl works,
but then it'll say pMLS.MarkerSymbol is a undefined method.

If I declare pMLS as ILineSymbol, I can set pMLS = pSbl, but I'm not able to get the MarkerSymbol related properties.
Could anyone share with me:
(1) How to obtain the Marker Symbol related properties from a ISymbol?
(2) How to determine the type of Symbol, e.g., SimpleLineSymbol or MarkerLineSymbol?

Thanks.

Outcomes