Accessing Arcobjects from Excel

381
3
03-06-2012 10:37 AM
VikramS
Occasional Contributor
Hello ,

I am trying to access arcobjects from excel vba . But I am getting an error . Below is my script . i have added all the references relating to ESRI .

Dim pworkspacefactory As IWorkspaceFactory2
Set pworkspacefactory = New FileGDBWorkspaceFactory
Dim pworkspace As IWorkspace
Dim s As String
s = "H:\\SPSD\\SPSD1.gdb"
If pworkspacefactory.IsWorkspace(s) Then
Set pworkspace = pworkspacefactory.OpenFromFile(s, 0) getting error here (Run-time error '-2147220952 (80040228)')
MsgBox pworkspace.PathName


I have another question as well .. Can we pass parameters to Arcmap if we open it through a batch file

Please help me
0 Kudos
3 Replies
NeilClemmons
Regular Contributor III
Are you checking out a license?  If not, then your code won't run.  Also, if you're using ArcGIS 10 then you will also have to bind to a product before checking out the license.
0 Kudos
VikramS
Occasional Contributor
Are you checking out a license?  If not, then your code won't run.  Also, if you're using ArcGIS 10 then you will also have to bind to a product before checking out the license.


Hi Neil ,

Thanks for the reply . I had a quick question .. How to check out a license ?

Thanks
0 Kudos
NeilClemmons
Regular Contributor III
Use IAoInitialize.
0 Kudos