View Single Post

  #16 (permalink)  
Old 05-08-2008
checkedout checkedout is offline
noob
White Belt
 
Join Date: Apr 2008
Location: Portland, Oregon
Posts: 9
Re: Trying to integrate Excel data into MapPoint

VICTORY!

Using a loop, it works! Yay!
Thanks to all who helped out.

Posting the code here for your edification:
Code:
Private Sub CommandButton1_Click()
Dim Row As Integer

  Set oApp = CreateObject("MapPoint.Application.NA.13")
  oApp.Visible = True
  Set objMap = oApp.NewMap
  Set objRoute = objMap.ActiveRoute
  
  szZip1 = Worksheets("Sheet1").Cells(2, 1)
  objRoute.Waypoints.Add objMap.FindResults(szZip1).Item(1)
  
  Row = 2
  While Worksheets("Sheet1").Cells(Row, 1) <> ""
    szZip = Worksheets("Sheet1").Cells(Row, 1)
    objRoute.Waypoints.Add objMap.FindResults(szZip).Item(1)
    objRoute.Calculate
    Worksheets("Sheet1").Cells(Row, 3) = objRoute.Distance
    Row = Row + 1
  Wend

 End Sub
- co
Reply With Quote