在VBA中或者VB中用IGeoProcessor接口中的Execute方法可以调用arcgis中所有Toolbox工具。
GP.Execute的命令名称格式如下:“工具名称(toolbox中的名称)”+下划线+所在工具集的假名。如“MosaicToNewRaster_management”
下面例子中调用了MosaicToNewRaster工具--镶嵌栅格数据
Set GP = New GeoProcessor
'===初始化GeoProcessor
Dim GP As IGeoProcessor
Set GP = New GeoProcessor
'===输出时覆盖同名文件
GP.OverwriteOutput = True
'//Declare 3 variables for input and output parameters
Dim inputPath As String
Dim outputPath As String
Dim tifName As String
'//定义参数
inputPath = "D:\TEST\Input1.TIF;D:\TEST\Input2.TIF"
outputPath = "D:\TEST"
tifName = "MOS.tif"
'//设置变量数组
Dim VA As IVariantArray
Set VA = New VarArray
'=====执行工具
下面是常用的工具名称及假名
1. Analysis Tools— analysis
2. Conversion Tools— conversion
3. Data Management Tools— management
4. 3D Analyst Tools— 3d
5. Cartography Tools— cartography
6. Geocoding Tools— geocoding
7. Geostatistical Analyst Tools— ga
8. Linear Referencing Tools— lr
9. Multidimension Tools— md
10. Network Analyst Tools— na
11. Samples— samples
12. Spatial Analyst Tools— sa
13. Spatial Statistics Tools— stats