2006 VBA Project References in Excel

onegalacticwino
05-08-2006, 12:12 PM
I installed MapPoint 2006, and changed the appropriate library (primarily MapPoint Object Library from 11.0 to 13.0).

However, when I run my excel macros, they are no longer functioning correctly. Any ideas? I think it has something to do with the declarations and settings at the begninning of my macro:

Dim objSW As MapPoint.SavedWebPage
Dim objMap As MapPoint.Map
Set objMap = GetObject(, "MapPoint.Application").ActiveMap
objMap.Application.Units = geoMiles
Dim shpParis As MapPoint.Shape
Dim objppt As Object
On Error Resume Next

Eric Frost
05-08-2006, 03:18 PM
I wonder if you still have MapPoint 2004 installed, maybe it is getting confused between the two? Try uninstalling MapPoint 2004 and re-installing MapPoint 2006 ?

Eric

WonderMonkey
05-20-2006, 09:56 AM
I wonder if you still have MapPoint 2004 installed, maybe it is getting confused between the two? Try uninstalling MapPoint 2004 and re-installing MapPoint 2006 ?

Eric

I would say this is a great candidate for the problem. The very nature of "GetObject" allows for this to happen. I found this to be a pretty big deal with multiple installs of Word, etc. back when I did VB6.

WonderMonkey
05-20-2006, 09:45 PM
Something was bugging me about this so I pondered.... afterwards I opened up the help file in 2004 and seen the following.

CreateObject is even more versatile, however. Using it, you can specify the version of MapPoint that you create by changing the ProgID that you pass into it. The following code creates one instance of MapPoint Europe and one of MapPoint North America (assuming that you have both installed on your computer):

Dim MPAppNA As MapPoint.Application
Dim MPAppEur As MapPoint.Application
Set MPAppNA = CreateObject("MapPoint.Application.NA")
Set MPAppEur = CreateObject("MapPoint.Application.EU")If you have multiple releases of MapPoint installed on your computer, you can also specify the release that you want to create. The following example creates an instance of MapPoint North America 2004:

Dim MPApp As MapPoint.Application
Set MPApp = CreateObject("MapPoint.Application.NA.11")Note MapPoint 2004 is version 11 of MapPoint.



Basically it shows how to use CreateObject and control which version to get.

 
Web mp2kmag.com
mapforums.com