VBA - how to automatically add rows to shp file?

701
1
11-20-2010 08:52 AM
KonradDebski
New Contributor
Hi there,

I am new to ArcObjects.
I would like to write a simple VBA macro (ArcView 9.3.1), that automatically adds new rows to my shp file. I couldnt find any example on the internet, so I post it here.

Detailed idea is:
Ex: I have shp file with 10 rows. Now Copy first row and duplicate it 4 times, then go to second row copy it and duplicate it 4 times, etc. In the result I should have 50 rows.

The duplicated points should be in the same position (just as 'copy a point and paste it in the same location' in editor mode)

Thanks for any help,
Konrad
0 Kudos
1 Reply
DuncanHornby
MVP Notable Contributor
Konrad,

There are several ways to create new rows in a layer. The easiest (but slowest if you are doing 100's of rows) is the IFeature.Store method. You get a handle on the Featureclass (your shapefile) then create a new Feature which you populate then store.  The key words you need to be searching for in the VBA developer help are IFeature, IFeatureClass and CreateFeature. If you are going to do any VBA development you should make sure you have VBA Developer Help installed.

Duncan
0 Kudos