MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Using MapPoint function from EXCEL VBA

This is a discussion on Using MapPoint function from EXCEL VBA within the MapPoint 2006/2009 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 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #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: 2,472
Blog Entries: 1
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 2009 ~
~
~ 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: 2,472
Blog Entries: 1
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
Reply

Tags
excel, function, mappoint, vba


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 2006/2009 Discussion 1 04-08-2005 11:48 PM
Correlation between Mappoint FIND function and MPC??? GM MapPoint 2006/2009 Discussion 0 11-02-2004 03:40 PM
Problems with ShowFindDialog function in C++ Anonymous MapPoint 2006/2009 Discussion 1 10-06-2003 05:13 AM
Fix DistanceTo function PC Wish List 1 03-21-2003 06:35 AM
Mappoint 2002 application provides the function th.... Anonymous MapPoint 2006/2009 Discussion 1 12-20-2001 10:48 AM


All times are GMT -5. The time now is 11:56 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
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