views:

1630

answers:

4

I've been asked a question by my manager and my initial thought was that it is not possible. Is there any way, using the scripting available to Excel 2007 to display a Google map inside a sheet?

I've used Excel to house the data that I've then gone and generated a KML file to load into Google Earth, but now they want to see a pretty little cell with a client address mapped out in Excel directly to pretty up the presentation.

Any thoughts, on the subject, would be appreciated.

thanks!

A: 

Google maps will require some kind of browser control on which to render the markup coming from a maps query. There is no such control in Excel.

However it should still be possible to process the results from G maps and obtain any info like latitude/ longitude etc.


I was wrong, a quick search on Google brought a couple of links. Here is one: http://www.automateexcel.com/2005/07/28/google_maps_in_excel/

Sesh
+4  A: 

Microsoft does have an ActiveX webbrowser control that I've used in the past and as Panji explainshow to create a web browser control in excel

Panji Tengkorak If what you're looking for is to display the html table as it is without the need to calculate the value later you can use WebBrowser Control, do this to add the WebBrowser control on a Sheet:

  1. In Excel open the form in Design view.
  2. Right-click the menu bar and then click Control Toolbox.
  3. In the toolbox, click the More Controls tool. A menu appears that lists all the registered ActiveX controls in your system.
  4. On the menu of ActiveX controls, click Microsoft WebBrowser Control.
  5. On the sheet, click where you want to place the control.
  6. Move and size the control to the area you want to display

Then put this line of code anywhere you want it, it can be on a button or on your workbook event. In the following example I use button click:

Sub Button3_Click() ThisWorkbook.ActiveSheet.WebBrowser1.Navigate2 "http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=area+51&sll=37.0625,-95.677068&sspn=31.839416,60.732422&ie=UTF8&ll=37.237811,-115.807614&spn=0.015614,0.029655&t=h&z=15" End Sub

It should be relatively simple to get coordinates from the spread sheet into the url.

jim
That is awesome, many thanks!
SomeMiscGuy
A: 

Google Earth also has an ActiveX Control (called the GEPluginX Control) you can embed in an Excel worksheet, as long as you have the Google Earth browser plugin installed (this is a separate installation from the standalone Google Earth application).

The ActiveX control has an API you can use to navigate the 3D view to different places (I believe you can load a KML file and view placemarks within that file)...

Google Earth Plugin

Jon Fournier
A: 

I know this is an old(er) post and I'm extremely thankful for the guidance I've already received (I have a macro running in my excel workbook w/ the code posted by Jim)....but I'm running into a wall when dissecting the google map address string.

I want the URL to reflect the lat/longs of specific cells (the 'easy' part that he mentions @ the end - lol, not for me!)....but I can't get the references to work? anyone have sample code of this?

say lat = a1 and long = a2 on the active worksheet;

I presume it would look very similar to Jim's area 51 address w/ range("a1").value in place of hardcoded lat/longs but I simply cannot get that to work.....any ideas?

many many thanks...

(and obviously - I can't even figure out how to ask a question - I posted this as an answer, sorry)

jordan