Referring to the code at
' http://stackoverflow.com/questions/9212398/how-to-determine-whether-a-geometry-is-multi-part
<SPAN class="kwd">static</SPAN><SPAN class="pln"> bool </SPAN><SPAN class="typ">IsMultiPart</SPAN><SPAN class="pun">(</SPAN><SPAN class="kwd">this</SPAN><SPAN class="pln"> </SPAN><SPAN class="typ">IGeometry</SPAN><SPAN class="pln"> geometry</SPAN><SPAN class="pun">) </SPAN><SPAN class="pln"></SPAN><SPAN class="pun">{</SPAN><SPAN class="pln"><BR /> </SPAN><SPAN class="kwd">var</SPAN><SPAN class="pln"> geometryCollection </SPAN><SPAN class="pun">=</SPAN><SPAN class="pln"> geometry </SPAN><SPAN class="kwd">as</SPAN><SPAN class="pln"> </SPAN><SPAN class="typ">IGeometryCollection</SPAN><SPAN class="pun">;</SPAN><SPAN class="pln"><BR /> </SPAN><SPAN class="kwd">return</SPAN><SPAN class="pln"> geometryCollection </SPAN><SPAN class="pun">!=</SPAN><SPAN class="pln"> </SPAN><SPAN class="kwd">null</SPAN><SPAN class="pln"> </SPAN><SPAN class="pun">&&</SPAN><SPAN class="pln"> geometryCollection</SPAN><SPAN class="pun">.</SPAN><SPAN class="typ">GeometryCount</SPAN><SPAN class="pln"> </SPAN><SPAN class="pun">></SPAN><SPAN class="pln"> </SPAN><SPAN class="lit">1</SPAN><SPAN class="pun">;</SPAN><SPAN class="pln"><BR /></SPAN><SPAN class="pun">}</SPAN>
I wrote a piece of VBA as below, but got a compiling error (Sub or Function not defined) at the line as highlighted below. What's wrong in this piece of code? Appreciate if you can point out.
Function IsMultiPart(geo As IGeometry)
Dim b As Boolean
Dim geometryCollection As IGeometryCollection
Set geometryCollection = CType(geo, IGeometryCollection)
If geometryCollection <> Null And geometryCollection.GeometryCount > 1 Then
b = True
Else
b = False
End If
IsMultiPart = b
End Function