Community of VE/MapPoint Users and Developers
This is a discussion on Adding Lat/long to polyline from excel within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I have some experience in Excel VBA but am still fairly new. This is the first time I have tried ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Adding Lat/long to polyline from excel Lets say that Latitudes were in the A column in Sheet1 and Longitudes were in the B column of Sheet1. I looked up the sample code for polyline and tried playing around with what I need to set the objLoc(x) to, but could not figure out anything that works. I want to replace the ? with something that will get the latitude and longitude from the excel spreadsheet, and then draw the shape in MapPoint. ************************************************** **** Sub AddPolylineToMap() Dim objApp As New MapPoint.Application Dim objMap As MapPoint.Map Dim objLoc(1 To 3) As MapPoint.Location 'Set up the application Set objMap = objApp.ActiveMap objApp.Visible = True objApp.UserControl = True 'Get three locations and zoom in Set objLoc(1) = ? Set objLoc(2) = ? Set objLoc(3) = ? Set objMap.Location = objLoc(1) 'Create a polyline by connecting these locations objMap.Shapes.AddPolyline objLoc End Sub ************************************************** **** Thanks for the help. |
| |||
| Re: Adding Lat/long to polyline from excel
Hi, You dont tell what exacly is not working. I assume you dont have a polyline. If that is the case I should start to check if the Location objects are correct. You can find this out by putting a pushpin on these locations.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: Adding Lat/long to polyline from excel
I have tried a few different things. For example, if I put the latitude and longitude in cells A1:A3 in the form Lat,Long and then try this for the code: Set objLoc(1) = Worksheets("sheet1").Range("A1") Set objLoc(2) = Worksheets("sheet1").Range("A2") Set objLoc(3) = Worksheets("sheet1").Range("A3") I get a "Run-time error ' 13': Type mismatch" error. I need to figure out what I need to set the objLoc(X) equal to so that it places the 'points' of the polyline at the locations from the excel spreadsheet. |
| ||||
| Re: Adding Lat/long to polyline from excel
can you show the format you are using for the lat/long? Like Wilfried said, try putting pushpins on the map first with code to verify you are passing the lat/long correctly.
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding Excel Data as Pushpins | rosshood10 | MapPoint 2006/2009 Discussion | 3 | 08-31-2006 11:25 AM |
| Adding Pushpins from Excel 2003 | Marktherob | MapPoint 2006/2009 Discussion | 2 | 02-07-2006 05:13 PM |
| Adding a PushPin from a Long/Lat position | zadic | MapPoint 2006/2009 Discussion | 2 | 10-06-2005 12:33 PM |
| Adding pushpins by lat/long or address using MPC in MSAccess | GM | MapPoint 2006/2009 Discussion | 0 | 11-01-2004 12:00 PM |
| in adding vendors in the excel side to be linked t.... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 11-14-2001 09:18 AM |
Ski Holidays Austria
Ski holidays in Austria offer ski schools for all types of skiers. They range from beginner classes of all ages to more advanced classes. Learn new techniques and refresh skills.
Travel Counselors
Travel Counselors are an award winning Travel Agent. Why not have a personal Travel Counselor help with your travel plans.
Holidays Jamaica
Holidays to Jamaica are a great way to immerse yourself in a different culture. Soak up some sun, indulge in some shopping, and relax at a beach resort. Use dealchecker.co.uk.
Holidays in Cyprus
Holidays in Cyprus are enriched by the abundance of churches, ruins and natural wonders. Book a holiday with us today!
Canaries
Find out all about the Canaries when you check out the ulookubook.com travel guides. Not only can you get a great holiday deal but you can find out useful information about potential holiday destinations.
Cheap family holidays
To plan cheap family holidays, use Travel.co.uk to explore all the delightful possibilities that there are.
Cheap holidays to Portugal
Enjoy a spectacular country at a fraction of the cost. Find information on cheap holidays to Portugal at On The Beach.