Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 have series of data in my GDB

I am running the program under VBA and what I want to do is using the data by the tool Kriging.

This is what I thought:

First, Kriging needs data that must be a point shape file and I am getting the data out of my GDB (one point in one table but there is a lot of data)

  1. I get the data I need and make it in a shape file
  2. I use the Kriging tool to calculate the shape file
  3. I use the raster to point tool to change the raster Kriging make to a point layer
  4. I get the point data I want!

Here is my question:

When I get the data from the GDB (using sql), how to change it to a shapefile in VBA?

I have only found the page to display XY data using VBA: but it's can't save as shape file!

How to save it automatically?

Is there any wrong with my steps?

If need more information please tell me!


An error occurred in the line

gp.FeatureClassToShapefile_conversion "'C:\Temp\New File Geodatabase.gdb\point'", Temp_2


automation error

unspecified error

how to fix it?

Call tools from ArcToolBox in VBA form

in this post about my problem I fix it like follow

gp.Kriging "C:\temp\123.shp", "F30", "C:\AA\Kriging_123", "Spherical 249.101224", "250"

but this time no matter what I try it's don't work....

share|improve this question
Thank you for edit my main question M(_ _)M – blueman010112 Jun 13 '11 at 10:34
the error on the line, gp.FeatureClassToShapefile_conversion "'C:\Temp\New File Geodatabase.gdb\point'", Temp_2, was because you need to change the layer sources to your layers. Use the three tools within the VBS code to create your own model in Model Builder. Once you have everything sourced to your layers then you can export the model to a script. You will just have to Dim gp as Object, Dim all your variables as Strings (as I did in my example), and change the, set gp = CreateObject("esriGeoprocessing.GPDispatch.1") line to as it is listed. – artwork21 Jun 13 '11 at 15:48
thanks for you support! – blueman010112 Jun 13 '11 at 16:48
up vote 3 down vote accepted

Since all your tasks are geoprocessing tasks you could just create a model and export out the model to either a vb, python, or jscript. Below is an example of a vbs script. You can then call the script with a macro or UI Control.

Dim gp As object

' Create the Geoprocessor object
set gp = CreateObject("esriGeoprocessing.GPDispatch.1")

' Check out any necessary licenses
gp.CheckOutExtension "spatial"

' Load required toolboxes...
gp.AddToolbox "C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx"
gp.AddToolbox "C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx"

' Local variables...
Dim Temp As String = "C:\Temp"
Dim point As String = "C:\Temp\New File Geodatabase.gdb\point"
Dim Temp__2_ As String = "C:\Temp"
Dim Kriging_poin1 As String = "C:\Temp\Kriging_poin1"
Dim Output_variance_of_prediction_raster As String = ""
Dim points_shp As String = "C:\Temp\points.shp"
Dim RasterT_kriging1_shp As String = "C:\Temp\RasterT_kriging1.shp"
Dim kriging_poin1__2_ As String = "C:\Temp\kriging_poin1"

' Process: Feature Class To Shapefile (multiple)...
gp.FeatureClassToShapefile_conversion "'C:\Temp\New File Geodatabase.gdb\point'", Temp__2_

' Process: Kriging...
gp.Kriging_sa points_shp, "ID", Kriging_poin1, "Spherical 51.968339", "51.968339", "VARIABLE 12", Output_variance_of_prediction_raster

' Process: Raster to Point...
gp.RasterToPoint_conversion kriging_poin1__2_, RasterT_kriging1_shp, "Value"
share|improve this answer
Thanks a lot!! I will try it right now~!! – blueman010112 Jun 13 '11 at 12:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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