Select to view content in your preferred language

MapControl in PowerPoint Slide

1078
4
08-22-2010 12:42 PM
ClaudeBanta
Emerging Contributor
Hi Everyone,
I'm trying to use an ESRI MapControl in a PowerPoint slide via a VBA macro.
When I use the AddShapefile or AddLayerFromFile method to add layers, I get the following error at runtime:

Method 'AddShapeFile' of object 'IMapControlDefault' failed.

The syntax I'm using is:

Me.MapControl1.AddShapeFile "C:\mywork\shapefiles", "cities"

I tried it with a backslash after the path and a ".shp" after "cities" but that didn't help. I also tried my luck with AddLayerFromFile but no dice.

Does anyone have other ideas about how to get it to work?

Thanks
0 Kudos
4 Replies
JanDuske
Emerging Contributor
You have to check out a license if you are using ArcObjects components in a non-esri application (like office). Do you already get a license via the IAoInitialize interface?
0 Kudos
ClaudeBanta
Emerging Contributor
You have to check out a license if you are using ArcObjects components in a non-esri application (like office). Do you already get a license via the IAoInitialize interface?


Yes I have a procedure that checks that the license is available and not checked out.  I debugged it to make sure that code runs successfully and it does.  I still get the AddShapeFile error though.
0 Kudos
ClaudeBanta
Emerging Contributor
I just want to let everyone know I got it working! 🙂 The solution was to use AddLayerFromFile and point to the .lyr file (which in turn pointed to the shapefiles).
0 Kudos
UsmanJamil
Emerging Contributor
hi cbanta,

i am also trying to do the same, i want to add a ArcMap .mxd to a powerpoint slide. can u kidnly tell me how can that be done?? the macro code for it and procedure?? would appreciate ur help..

Regards,

Osman
0 Kudos