Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for guidance, suggestions, tips, or insights in performing a sequence of operations using VB macros for ArcGIS.

A) Creating a new table

How to write a macro in VB that creates a new table with its associated fields, loads the table to the current data frame, and adds the required records? For instance, a parcel table with fields

P_ID (Long)
L_Use_Code (Long)
L_Use_Name (string)
Owner_ID (Long)

B) Creating a new feature class

How to write a VB macro that creates a new shapefile feature class called “Parcel” and adds it to the map window?

C) Relating and joining data to layers

How to write a macro in VB that relates a table (as in (A)) to a layer (as in (B))?

D) Identification

How to write a macro in VB that shows a feature cursor operation to display the values of a given field for each row in a feature layer table?

share|improve this question
The downvotes may have been received due to the lack of formatting of the original text, which I have cleaned up; I hope it correctly reflects your questions, Bernabas. The downvotes may also reflect a perception that such a broad, basic question might result from a lack of research or previous investigation on your part. I won't speculate on that, but would only suggest you consider indicating where you have previously looked for help and where specifically you have encountered problems or obstacles in carrying out your objectives. – whuber Jan 2 '12 at 15:42
Also VBA is basically a dead language. – blah238 Jan 3 '12 at 17:52
I would suggest looking into c#. VBA for arcgis is dead is not coming back. – George Jan 4 '12 at 12:21

If you insist on using VBA, Kang-Tsung Chang's Programming ArcObjects with VBA: A Task-Oriented Approach carries the answers to all your questions. It's written in cookbook format, which means answers are presented as encapsulated how-to code-samples for various topics rather than a "start programming from scratch" point of view.

Having said that, I want to further emphasize the point of the previous commentors: VBA is done, and ArcGIS will no longer support it. You must realize anything you code in VBA will require efforts later to rewrite it for a .Net implementation.

A discussion on getting started with ArcObjects and .Net can be found on this stackoverflow thread; unfortunately, though, there is a dearth of print media on the subject of programming ArcObjects with.Net. ESRI provides the best resource I know of, and you can start here. At the top of the page, note the links to Concepts and Samples, API Reference, and Code Gallery. ..personally, I get more use out of the API Reference (drill-down to .Net Samples in the menu at left) than anything else. For instance, here's a Create FeatureClass Snippet with examples in both VB.Net and C#.

Most of your questions relate to fundamental ArcObjects tasks, so I think it will be relatively easy to find help in the online reference; however, I suspect linking your first .Net solution into the ArcGIS Desktop UI (i.e. making a Button) may present some frustration. For that you'll need to install Visual Studio and the ArcObjects SDK (the SDK is included among the ArcGIS installation media). The ArcObjects SDK exposes various code "templates" to Visual Studio, and these are most helpful for creating buttons, et cetera. This example demonstrates how to create a ZoomTo button. Once you have Visual Studio running and the ArcObjects SDK installed, that tutorial will help you understand how to start a new project, and it will take you all the way through getting a new button in your ArcMap application window.

I think if you "daisy-chain" these resources together, you can probably dog-paddle through a DIY learning process. But don't expect it to be fast and easy. Be prepared to do alot of reading and endure some let-downs along your way to success.

share|improve this answer

protected by Community Jan 4 '12 at 15:49

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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