In ArcView 9.2 I am trying to set up a UIButtonControl containing VBA code to a)create a new personal GDB b)then write feature data (previously brought into ArcMap) to this new GDB. When I open ArcMap with some features(polylines,points,polygons) I want to be able to hit this UIButtoncontrol and create/populate a PGDB.
Although it runs outside of ArcView, there is a sample VBA project in the ArcGIS Developer Kit for 9.2 called Create_and_load_personal_geodatabaseVisualBasic, which appears to do 80 percent of what I need. Using various ArcObjects interfaces, it creates sample points,polygons,polylines etc. However there is no explanatory documentation, it doesn't work properly and before I took out some 'progress' controls this sample Developer Kit sample project wouldn't even compile. I've got it to create an empty PGDB and then it gives an automation error on trying to open:
snippet:
Dim pProperty As IpropertySet
Set pProperty = New PropertySet
Dim pWorkspaceName As IName
On Error GoTo Duplicate
Set pWorkspaceName = pWorkspaceFactory.Create(App.Path, databaseName, pProperty, 0)
Set pWorkspace = pWorkspaceName.Open
Exit Sub
Duplicate:
MsgBox "Database already exists.", vbExclamation + vbOKOnly, "Duplicate Database"
Err.Clear
On Googleing the issue I literally get one reference, to the sample code itself.
Can anyone help with this problem, and is there a tutorial anywhere which takes you through each step for writing feature classes to a PGDB in VBA?