MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Help W Excel Mappoint VBA

This is a discussion on Help W Excel Mappoint VBA within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I'm a new developer to MP, and only OK w/VBA in excel. I'm trying to write an Excel UDF that ...


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-18-2006
Junior Member
White Belt
 
Join Date: Apr 2006
Posts: 6
Help W Excel Mappoint VBA

I'm a new developer to MP, and only OK w/VBA in excel. I'm trying to write an Excel UDF that calculates the distance between two addresses. I've already been around the net, including here:

http://www.dailydoseofexcel.com/inde...tions/&paged=2 (scroll down)

I'm having trouble with getting the FindAddressResults method to work, though I can make FindResults work fine.

I've beed so fristrated getting this to work, that I've abandon the UDF and am working with a simple plotting script from somewhere on the web. When I run it, I get the following message: "the parameter is incorrect"

Here's my code:
Code:
Private Sub mapit()
Dim oApp As MapPoint.Application
Dim Objloc As MapPoint.FindResults
  Set oApp = CreateObject("MapPoint.Application.NA.11")
  oApp.Visible = True
  Set oBJMap = oApp.NewMap
 
  'From online instructions: object.FindAddressResults([Street], [City],_
        '[OtherCity], [Region], [PostalCode], [Country])
  '*************
  'Samples coppied from MS website
  '*** Set objLoc = objMap.FindAddressResults("1 Microsoft Way", "Redmond", "WA")(1)
  '****Set objloc = objApp.ActiveMap.FindAddressResults("One Microsoft Way", "Redmond", , "WA
  '******
  'My code that doesn't work -- I get "the parameter is incorrect" error
       Set Objloc = oBJMap.FindAddressResults("4724 Main Street", "Downers Grove", "IL")(1)
  '******************
  oBJMap.AddPushpin Objloc, "NAME"
  objMap.DataSets.ZoomTo
End Sub

Please 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
  #2 (permalink)  
Old 04-19-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,094
Hi,

FindAddressResults need 6 arguments, where some of them may be an empty string:

Code:
FindAddressResults(street, city, othercity, region, zip, country);
I see only 3 in your example.

BTW: What is the meaning of the extra parentesis '(1)' ?
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-19-2006
Junior Member
White Belt
 
Join Date: Apr 2006
Posts: 6
So I have tried it every logical way, ut it doesn't work for me. The code you see above is taken right from the MS website, but I can't make it work. I've tried the 6 arguments suggested and every other logical combination.

Obviously I'm doing somthething wrong, but my code looks to me exactly like the code from the MS website. Very frustrating.

Help.

EW
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 04-20-2006
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,378
Blog Entries: 1
Wilfried -- I think FindAddressResults actually returns a collection so the extra parentheses tells it to use the first item in the collection.

Eric -- have you tried the samples in the Help File? Also, take a look at the series of MapPoint / Excel mini-tutorials in the newsletters.

By the way, my name is also Eric and I live in Chicago and am a consultant and MapPoint programmer, we should get together for a beer sometime.

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
  #5 (permalink)  
Old 04-20-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,094
Hi Eric,

Ok I do not know VB, but if the second parentasis is telling to use the first item in the collection, what happens if this item is NULL? Could that give an error ?

Just do some guessing of course ...
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-21-2006
Junior Member
White Belt
 
Join Date: Apr 2006
Posts: 6
Still Frustrated

Eric,

Thanks for the post. Happy to buy the beer if you can help me solve this problem.

I couldn't find FindAddressResults in Mappoint's Help, and I actually did go to through all of the web tutorials. In fact, when I cut and paste the code from the tutorials to Excel VBA, the ones with FindAddressResults fail to work. As I menioned above, FindResults seems to work for me. There is somethig with the syntax in FindAddressResults that I'm missing and it's driving me nuts.

Please help.

Cheers,

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
  #7 (permalink)  
Old 04-21-2006
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,378
Blog Entries: 1
Just a long shot, but are you possible using MapPoint 2000 or 2001? -- or is either version installed on the machine?

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
  #8 (permalink)  
Old 04-23-2006
Junior Member
White Belt
 
Join Date: Apr 2006
Posts: 6
Help with map point Excel VBA

I'M using Mappoint North America 2004 and I can get the Findresults method to work just find. It's FindaAddressResults that is failing.

Help

EW
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 04-24-2006
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,378
Blog Entries: 1
Did you try the example from the Help file?

Sub FindAddressSearch()
Dim objApp As New MapPoint.Application
Dim objFindResults As MapPoint.FindResults

'Set up application
objApp.Visible = True
objApp.UserControl = True

'Output first result of find search
Set objFindResults = objApp.ActiveMap.FindAddressResults("One Microsoft Way", "Redmond", , "WA", , geoCountryUnitedStates)
MsgBox "The first item in the find list is: " _
+ objFindResults.Item(1).Name

End Sub
__________________
~ 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
  #10 (permalink)  
Old 04-24-2006
Junior Member
White Belt
 
Join Date: Apr 2006
Posts: 6
Example From Help fails

I cut and paste your example directly into the Excel VBA and run the app.

Mappoint kicks off and shows a map of the USA, but then the VBA gets an error "Cannot parse an addresssin the specified country". I tried substituting "United States", 244, and leaving hte country blank. No joy.

Help!

Cheers,

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, 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
mappoint and excel mike_v MapPoint 2006/2009 Discussion 0 05-30-2006 02:35 PM
Excel & MapPoint Dingo1 MapPoint 2006/2009 Discussion 5 12-12-2005 07:14 PM
Excel and MapPoint Eric Frost MapPoint 2006/2009 Discussion 0 05-09-2005 09:01 PM
Mappoint & Excel Anonymous MapPoint 2006/2009 Discussion 0 10-27-2004 03:38 AM
MPControl embedded in excel - excel loses functionality ruyasan MapPoint 2006/2009 Discussion 2 05-20-2004 03:41 AM


All times are GMT -5. The time now is 10:33 PM.


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

Ski Breaks
Book ski breaks to a range of great ski destinations online at Holiday Hypermarket. It is quick, easy and best of all, fantast value.

Business Travel Agent
Leading Business Travel Agent. Personal service is at the heart of our business. Talk to one of our travel agents today.

Cheap Holiday Turkey
Booking a cheap holiday to Turkey doesn't have to be at the expense of enjoyment. Dealchecker.co.uk searches holidays from the leading UK Tour Operators.

Nile Cruises
Nile cruises are one of the best ways to discover the riches of Egypt. See ancient ruins and lush verdure from the River Nile. Book today!

Cheap Egypt Holidays
Pick up a bargain cheap Egypt holiday online when you visit ulookubook.com. Just check out our tips to make sure you book at the right time to get a great holiday for a great price. Finding cheap Egypt holidays can be simple when you know how.

Family package holidays
Save a lot of time and opt for one of the great family package holidays at Travel.co.uk

Cheap Holidays in Gran Canaria
Would you like to visit the Canary Islands, but you're on a budget? Get information on cheap holidays in Gran Canaria at On The Beach.


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