


Set pFeatureWorkspace = pWorkspaceFactory.OpenFromFile("c:\kkim\Bangladesh_project\" & strInputFileName, 0) Set pWorkspaceFactory = New ShapefileWorkspaceFactory ' Specify the workspace and the shape file PShpToFC.ConvertFeatureClass pName, Nothing, Nothing, pDatasetName1, Nothing, Nothing, "", 1000, Application.hWndĭim pWorkspaceFactory As IWorkspaceFactoryĭim pFeatureWorkspace As IFeatureWorkspace ' Part 6: Defining the input was done above at part 4 as pName = pXYEventSourceName Set pDatasetName1.WorkspaceName = pWorkspaceName1 PWorkspaceName1.WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory" PWorkspaceName1.PathName = "c:\kkim\Bangladesh_project\" & strInputFileName Set pFLayer.FeatureClass = pXYEventSource ' Create a new feature layer and add the layer to the active map. ' Part 4: Create a layer from the event source and display the layer. SpatialReference = pGeographicCoordinateSystem EventProperties = pXYEvent2FieldsProperties Set pXYEventSourceName = New XYEventSourceName ' Specify the event source and its properties. Set pGeographicCoordinateSystem = pSpatialReferenceFactory.CreateGeographicCoordinateSystem(esriSRGeoCS_WGS1984) Set pSpatialReferenceFactory = New SpatialReferenceEnvironment Set pXYEvent2FieldsProperties = New XYEvent2FieldsProperties Set pDatasetName.WorkspaceName = pWorkspaceNameĭim pXYEvent2FieldsProperties As IXYEvent2FieldsPropertiesĭim pSpatialReferenceFactory As ISpatialReferenceFactoryĭim pGeographicCoordinateSystem As IGeographicCoordinateSystemĭim pXYEventSourceName As IXYEventSourceName PWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesGDB.AccessWorkspaceFactory" PWorkspaceName.PathName = "c:\kkim\Bangladesh_project\" & strInputFileName & "\" & strInputFileName & ".mdb" ' Part 2: Define the input data file in Access. Set ACC = CreateObject("Access.Application", "")ĪCC.OpenCurrentDatabase "C:\kkim\Bangladesh_project\" & strInputFileName & "\" & strInputFileName & ".mdb"ĭoCmd.TransferSpreadsheet acImport, 8, strInputFileName, "C:\kkim\Bangladesh_project\" & strInputFileName & "\" & strInputFileName & ".xls", True

' Open Access database and get outside Excel into the database StrInputFileName = InputBox("Enter the input file name:") 'Microsoft Office 12.0 Access database engine object library In your case, you may just start from creating XY Event from the table in geodatabase and then create a feature class from it, which may be simpler than the sample macro. The macro first takes an Excel sheet to a personal geodatabase, then creates XY Event, then makes a shape file from it. Years ago I created a VBA macro converting Excel to shapefile, with details below. I have a table in access database which has an x and Y value i need to convert this into File geodatabase now.
