The problem is:

I need to copy every cell's value of attribute table of some feature to string array.

I do it by assigning cell's value to string variable StrBuf one by one.

To check the result the MsgBox will show StrBuf value.

Table example

Below is a part of code and result MsgBox window:


But when I assigne Shape field's value to StrBuf - the error is: "Run-time error '13' Type mismath"

My question is which type (instead of String) should I choose for StrBuf variable to avoide this error?

I use arcgis 10.2.2 , scripting in VBA.


If I have understood you correctly you want to store the text "Polygon" in your array?

Shape is the Geometry field so the mismatch error is to be expected, you are trying to store a polygon geometry in a string variable which makes no sense.

As a FeatureClass can only be one type of Geometry I would simple write the text straight into your polygon as that can never change.

Let StrBuff  ="Polygon"
  • @Alex if you intend to run this on shapefiles with different geometries then yes you would need to test with a case statement. But you only need to do it once before the main loop reading the data as a geometry type will never change within a FeatureClass. – Hornbydd Dec 4 '15 at 11:48
  • This is not completely true. NIL shapes are also a potential result. Some folks also want to make a distiction between single-part and multi-part shapes. – Vince Dec 4 '15 at 12:45

@PolyGeo Thanks a lot!!

In other words, every time I assigning cell's value to string variable - I have to check if the Field is the Geometry Field, correct?

If the field type is Geometry then I have to get a field value from the feature property like this way:

'Geometry type

Dim Ftype As Integer
Ftype = pCounty.Shape.GeometryType

Select Case Ftype

    Case 0
StrBuf = "Null"
    Case 1
StrBuf = "Point"
    Case 2
StrBuf = "Multipoint"
    Case 3
StrBuf = "Polyline"
    Case 4
StrBuf = "Polygon"
    Case 5
StrBuf = "Envelope"
    Case 6
StrBuf = "Path"
    Case 7
StrBuf = "Any"
    Case 9
StrBuf = "MultiPatch"
    Case 11
StrBuf = "Ring"
    Case 13
StrBuf = "Line"
    Case 14
StrBuf = "CircularArc"
    Case 15
StrBuf = "Bezier3Curve"
    Case 16
StrBuf = "EllipticArc"
    Case 17
StrBuf = "Bag"
    Case 18
StrBuf = "TriangleStrip"
    Case 19
StrBuf = "TriangleFan"
    Case 20
StrBuf = "Ray"
    Case 21

End Select

It's a rather cumbersome way. Is there any property of pFeature containing just a string "Point" or "Polygon" (not corresponding code number)?

I couldn't find any.

  • No, what you are doing is correct. – Hornbydd Dec 4 '15 at 12:58
  • 1
    You've left out the null (0) and multipoint (2) types. Shapefiles make a distinction between the plain, Z, M, and ZM variants of the types with vertices, though that ArcObjects interfaces does not. – Vince Dec 4 '15 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.