View Single Post

  #1 (permalink)  
Old 04-18-2006
Eric_j_wick Eric_j_wick is offline
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.
Reply With Quote