Select to view content in your preferred language

How to determine the type of Marker Symbol used for a Marker Line Symbol using VBA?

624
2
02-03-2012 06:21 AM
ChristineGo
Emerging Contributor
By using TypeOf, I could tell a symbol is a Marker Line Symbol.
Can I use the same trick (something as follow) to check whether this Marker Line Symbol is build up from which type of Marker Symbol?

If TypeOf pSbl Is IMarkerLineSymbol Then
    MsgBox "It is a Marker Line Symbol"

    If TypeOf pSbl Is ICharacterMarkerSymbol Then
        MsgBox "It is a Character Marker Symbol"
    elseif TypeOf pSbl Is IPictureMarkerSymbol Then
        MsgBox "It is a Picture Marker Symbol"
    End if
End If
0 Kudos
2 Replies
GeorgeFaraj
Frequent Contributor
Have you tried it? (Seems reasonable to me.)

In C# I just do:
IMarkerLineSymbol symbol = someObject as IMarkerLineSymbol;
if (symbol != null) { 
  //do something with symbol
}


I think the VB equivalent is:
Dim symbol As IMarkerLineSymbol = TryCast(someObject, IMarkerLineSymbol)
If Not (symbol Is Nothing) { 
  //do something with symbol
}
0 Kudos
ChristineGo
Emerging Contributor
Yes, there's a MarkerSymbol property inside the MarkerLineSymbol.
By checking the symbol type of the MarkerSymbol using TypeOf, I'm able to check which type of marker symbol the MarkerLineSymbol is built on.
0 Kudos