PROBLEM
The Data Link Properties dialog box is erroneously called when using the OpenFromString method on the IWorkspaceFactory2 interface, implemented on the OleDBWorkspaceFactory CoClass. The workspace object should be created using the parameters supplied in the connection string, and it should not require any additional input via the dialog box.
This is a known issue.
Code:
Dim sFile As String
sFile = "C:\WINNT\Profiles\username\Application Data\ESRI\ArcCatalog\OLEDB Data.odc"
Dim pWorkspaceFact As IWorkspaceFactory
Set pWorkspaceFact = New OLEDBWorkspaceFactory
Dim pWorkspace As IWorkspace
Set pWorkspace = pWorkspaceFact.OpenFromFile(sFile, 0)
Code:
Dim pPropset As IPropertySet
Set pPropset = New PropertySet
pPropset.SetProperty "CONNECTSTRING","Provider= MSDASQL.1;data source=Excel_wks"
Dim pWorkspace As IWorkspace
Dim pWorkspaceFact As IWorkspaceFactory
Set pWorkspaceFact = New OLEDBWorkspaceFactory
Set pWorkspace = pWorkspaceFact.Open(pPropset, 0)
Get help from ArcGIS experts
Download the Esri Support App