MapPoint Forums

MapForums

Community of MapPoint and Bing Maps Users and Developers




Using MapPoint function from EXCEL VBA

This is a discussion on Using MapPoint function from EXCEL VBA within the MapPoint Desktop Discussion forums, part of the Map Forums category; I have this code in an excel file; the idea being to read two postcodes from cells A1 and B1, ...


Go Back   MapPoint Forums > Map Forums > MapPoint Desktop Discussion

Today's Posts Twitter Feed Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 04-25-2005
Junior Member
White Belt
 
Join Date: Apr 2005
Posts: 5
Using MapPoint function from EXCEL VBA

I have this code in an excel file; the idea being to read two postcodes from cells A1 and B1, and return the distance between them to Cell C1.
I think the code is ok, but when I run it it says "User-Defined type not defined" and highlights the second line.

Do I need to set up a specific tools>reference in Excel VBA first?

Pretty please?!
______________

Sub ShowDistance()
Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objLocOne As MapPoint.Location
Dim objLocTwo As MapPoint.Location

Dim LocOne, LocTwo As String
Dim Distance As Long

Set objMap = objApp.ActiveMap

LocOne = Cells(1, 1)
LocTwo = Cells(1, 2)

Set objLocOne = objMap.FindResults(LocOne).Item(1)
Set objLocTwo = objMap.FindResults(LocTwo).Item(1)


'Show the distance

Distance = objMap.Distance(objLocOne, objLocTwo)

Cells(1, 3) = Distance

End Sub
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 04-25-2005
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 3,500
Blog Entries: 3
Hi Jonboy,

I wrote a tutorial related to this earlier this afternoon which I plan to publish tomorrow --
http://www.mp2kmag.com/update/mappoi...er/2005-04-26/

I think the answer to your question is actually in the Part I of the tutorials.

Eric
__________________
~ Now taking orders for MapPoint 2010 ~
~~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 04-26-2005
Junior Member
White Belt
 
Join Date: Apr 2005
Posts: 5
woohoo

Got it working now, thanks Erik.
Batch files here I come.

Looking forward to part IV (which hopefully will include "fuzzy" address searches *cough* )
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 07-12-2007
JuL JuL is offline
Junior Member
White Belt
 
Join Date: Jul 2007
Posts: 1
Re: Using MapPoint function from EXCEL VBA

I've just tried the code provided in the tutorial part III, but vba keeps on returning the same error message (Run-time error '429': ActiveX component can't create object ...) I'm running Excel 2003 and MapPoint 2004. Is there something I'm missing here?

Thanks for your help!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 07-23-2007
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 3,500
Blog Entries: 3
Re: Using MapPoint function from EXCEL VBA

Check the reference under Tools References, it should not be the ActiveX control.

Also, you might try doing this at the command line mappoint.exe /register

Eric
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 04-30-2009
Junior Member
White Belt
 
Join Date: Apr 2009
Posts: 2
Re: Using MapPoint function from EXCEL VBA

Hi Eric,
I have tried all the above steps, and also gone through the first tutorial in detail. I still receive the error:
(Run-time error '429': ActiveX component can't create object ...)

Not sure what is going wrong. I am using Office 2007 on Vista home, and using the trial version of MapPoint.
Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 04-30-2009
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 3,500
Blog Entries: 3
Re: Using MapPoint function from EXCEL VBA

What version of MapPoint? I wonder if it is the MapPoint 2009 trial, if it hangs asking for the Activation code.

Eric
__________________
~ Now taking orders for MapPoint 2010 ~
~~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 05-01-2009
Junior Member
White Belt
 
Join Date: Apr 2009
Posts: 2
Re: Using MapPoint function from EXCEL VBA

Eric,
I figured, it was about EU versus NA, and 16 versus 11. Thanks. I now need to fetch distances for multiple origin-destination pairs. Where can I find some sample code for the same?
Do I need to worry about closing and opening MapPoint for each 'fetch'? Or would the application handle 4-5000 distances without crashing?

Thanks for your help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
excel, function, mappoint, vba


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/using-mappoint-function-excel-vba-4091.html

Posted By For Type Date
Gmane -- Mail To News And Back Again This thread Refback 06-19-2009 03:32 PM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Need Help using the SUM function for County Anonymous MapPoint Desktop Discussion 1 04-08-2005 10:48 PM
Correlation between Mappoint FIND function and MPC??? GM MapPoint Desktop Discussion 0 11-02-2004 02:40 PM
Problems with ShowFindDialog function in C++ Anonymous MapPoint Desktop Discussion 1 10-06-2003 04:13 AM
Fix DistanceTo function PC Wish List 1 03-21-2003 05:35 AM
Mappoint 2002 application provides the function th.... Anonymous MapPoint Desktop Discussion 1 12-20-2001 09:48 AM


All times are GMT -5. The time now is 12:22 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
MP2K Magazine
Visitor Map



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67