PDA

View Full Version : macro for route if needs a ferrry



shahdelsol
07-24-2009, 01:03 PM
I am using the following code for calculating distance between 2 zipcodes but I need another code to tell me when the route needs taking ferry. For example if the distance between zipcode 98108 and 98110 is 11 miles with ferry,I want a code which is able to insert "this route needs ferry" for example in cells (1,2) in red. Here is the macro I am using and I appreciate your help:
Private Sub CommandButton2_Click()
Dim oApp As MapPoint.Application

Set oApp = CreateObject("MapPoint.Application.NA.16")
oApp.Visible = True
oApp.UserControl = True
Set objMap = oApp.NewMap
Set objRoute = objMap.ActiveRoute

szZip1 = Worksheets("sheet1").Cells(5, 2)
szZip2 = Worksheets("sheet1").Ce1lls(6, 2)

'Add route stops and calculate the route
objRoute.Waypoints.Add objMap.FindResults(szZip1).Item(1)
objRoute.Waypoints.Add objMap.FindResults(szZip2).Item(1)
objRoute.Calculate

End Sub

Eric Frost
07-25-2009, 03:48 PM
I wonder if you loop over the directions and just look for the word Ferry.

Might be some false hits, but it might put you on a path to finding a pattern that would reliably indicate Ferry use.

Eric

shahdelsol
07-26-2009, 05:44 AM
I wonder if you loop over the directions and just look for the word Ferry.

Might be some false hits, but it might put you on a path to finding a pattern that would reliably indicate Ferry use.

Eric
What would be a code for looping over map for word "ferry" and then insert it in a cell

Eric Frost
07-26-2009, 09:56 AM
The Route object has a Directions property, see the Help file for examples.

Eric

shahdelsol
07-26-2009, 01:24 PM
The Route object has a Directions property, see the Help file for examples.

Eric
sorry I am a rockie I don't know how could you please help me...thanks

Eric Frost
07-26-2009, 01:45 PM
Did you find that object and property and the examples in the help file?

shahdelsol
07-26-2009, 03:24 PM
Did you find that object and property and the examples in the help file?
well that's problem i don't knwo how to look and what to look i am rookie i copy and paste that code i didn't write it so i am very unexperienced

Eric Frost
07-26-2009, 04:27 PM
Well, I don't think what you're asking is that easy, it will take some trial and error, some knowledge of string parsing / matching. Can you get some help there from someone with programming skills?

Eric

shahdelsol
07-26-2009, 04:56 PM
Well, I don't think what you're asking is that easy, it will take some trial and error, some knowledge of string parsing / matching. Can you get some help there from someone with programming skills?

Eric
not really that's why I came here. I appreciate your help so far. If you could help me for the rest that would be nice of you other than I hope someone else will respond

jakevo
01-16-2010, 06:07 AM
hi all

does somebody solve that problem? I am intersted to do it as well

thx

shahdelsol
09-11-2010, 06:59 PM
hi all

does somebody solve that problem? I am intersted to do it as well

thx
No I am still waiting for response... I have noticed if route required ferry, mappoint on direction shows " *check timetable* " it means if I have macro looks for this specific word *check timetable* and insert it in specific cell, then I would know the route requires ferry. Does anybody know how to look for this word?

rodman
10-02-2010, 01:10 PM
See this link for final result:
http://www.mapforums.com/how-look-specific-word-mappoint-direction-14158.html