I have a DLL file that I have loaded and registered it in ArcGIS as a command icon. This icon launches a window where the user should do the following selections: an input file, a field name, select between 2 option buttons and an output file name. However, I need to run this DLL file via a VBA and ArcObjects code so as the user will not see the window of the DLL tool and the above selections will be given automatically by the code within a loop so as to take various output files. Is that possible? Please help. Thanks Demetris
Eventually I found a function that may be is approprite to call the DLL file. I declare it below and I try to call it via the Calldll() procedure. However, I receive the following message "Run-time error 13- Type mismatch". I think that the arguments have the appropriate data type. Could you please have a look in the code below to find what is going on? Thanks again Demetris
Public Declare Function CreateParcelsShape Lib "C:\Program Files\ArcGIS\CreatePoly.dll" (Centroids As IFeatureClass, Block As IPolygon, pFDS As IFeatureDataset)
Public Sub CallDll()
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
'Get the active map (data frame)
Dim pMap As IMap
Set pMap = pMxDoc.FocusMap
'Get the layers
Dim pLayers As IEnumLayer
Set pLayers = pMap.Layers
Dim pLayer1 As ILayer
Set pLayer1 = pLayers.Next
Do Until pLayer1 Is Nothing
If pLayer1.Name = "Block12" Then
Exit Do
End If
Set pLayer1 = pLayers.Next
Loop
Dim pBlocks As IFeatureLayer
Set pBlocks = pLayer1
Dim pBlocksFC As IFeatureClass
Set pBlocksFC = pBlocks.FeatureClass
Dim pBlocksCursor As IFeatureCursor
Set pBlocksCursor = pBlocksFC.Search(Nothing, False)
Dim pBlockFeature As IFeature
Set pBlockFeature = pBlocksCursor.NextFeature
'Get the shape of the polygon (Block)
Dim polygon As IPolygon
Set polygon = pBlockFeature.Shape
Dim pLayers2 As IEnumLayer
Set pLayers2 = pMap.Layers
Dim pLayer2 As ILayer
Set pLayer2 = pLayers2.Next
Do Until pLayer2 Is Nothing
If pLayer2.Name = "CentroidsBlock12" Then
Exit Do
End If
Set pLayer2 = pLayers2.Next
Loop
Dim pCentroids As IFeatureLayer
Set pCentroids = pLayer2
Get the dataset
Dim pFDataSet As IFeatureDataset
Dim pFWorkspace As IFeatureWorkspace
Dim pAWFactory As IWorkspaceFactory
Set pAWFactory = New AccessWorkspaceFactory
Set pFWorkspace = pAWFactory.OpenFromFile("C:\LACONISS\GAPopulation.mdb", 0)
Set pFDataSet = pFWorkspace.OpenFeatureDataset("Polygons")
'Call the DLL function
CreateParcelsShape pCentroids, polygon, pFDataSet
End Sub