MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Adding Lat/long to polyline from excel

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  14 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 05-04-2007
Junior Member
White Belt
 
Join Date: May 2007
Posts: 2
Adding Lat/long to polyline from excel

I have some experience in Excel VBA but am still fairly new. This is the first time I have tried to automate MapPoint with it though. What I want to do is create a Freeform in MapPoint with the 'points' retrieved from the excel workbook.

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.
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 05-05-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,047
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.
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 05-07-2007
Junior Member
White Belt
 
Join Date: May 2007
Posts: 2
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.
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 05-15-2007
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
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
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


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/adding-lat-long-polyline-excel-5867.html

Posted By For Type Date
Using MapPoint In Delphi - MapPoint Articles - MP2K Magazine This thread Refback 05-14-2007 01:33 PM
Snap to a Road - MapPoint Articles - MP2K Magazine This thread Refback 05-14-2007 01:24 PM
Delphi Address Verifier - MapPoint Articles - MP2K Magazine This thread Refback 05-14-2007 01:22 PM
A More Compact Method for Obtaining Lat/Long - MapPoint Articles - MP2K Magazine This thread Refback 05-14-2007 03:04 AM
An API to Control MapPoint 2006 GPS Features - Part I of II - MapPoint Articles - MP2K Magazine This thread Refback 05-10-2007 07:09 PM
Using MapPoint In Delphi - MapPoint Articles - MP2K Magazine This thread Refback 05-10-2007 02:24 PM
Using MapPoint In Delphi - MapPoint Articles - MP2K Magazine This thread Refback 05-10-2007 02:17 PM
Extending the MapPoint ActiveX Control - Pt. I - MapPoint Articles - MP2K Magazine This thread Refback 05-09-2007 12:06 PM
Pocket Streets Conversion Tool Made Available - MapPoint News - MP2K Magazine This thread Refback 05-09-2007 11:09 AM
Microsoft MapPoint 2006 - MP2K Magazine This thread Refback 05-08-2007 01:20 AM
Working With Excel and MapPoint - MP2K Magazine This thread Refback 05-08-2007 12:33 AM
A More Compact Method for Obtaining Lat/Long - MapPoint Articles - MP2K Magazine This thread Refback 05-07-2007 01:12 PM
MapPoint Download - MP2K Magazine This thread Refback 05-05-2007 05:58 PM
Microsoft Learning Suite - MapPoint - MapPoint News - MP2K Magazine This thread Refback 05-05-2007 07:43 AM

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
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


All times are GMT -5. The time now is 04:16 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5
MP2K Magazine
Visitor Map

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.


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