+ Reply to Thread
Results 1 to 5 of 5

Google Maps integration

Hybrid View

  1. #1
    Registered User
    Join Date
    12-09-2008
    Location
    Canada
    Posts
    79

    Google Maps integration

    I am wondering if anyone knows how to integrate a compact version of Google Maps (without any navigation bars or options) into Excel?

    Basically, I need something like this (only the map portion):
    http://maps.google.ca/maps/empw?url=...ed&hl=en&gl=ca

    I'd like to be able to display a different location based on an address somewhere in the sheet.
    Last edited by GeorgY; 12-28-2011 at 10:51 PM.

  2. #2
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Google Maps integration

    http://www.automateexcel.com/2005/07...maps_in_excel/

  3. #3
    Registered User
    Join Date
    12-09-2008
    Location
    Canada
    Posts
    79

    Re: Google Maps integration

    Thanks, I found a way to display Google maps API in a WebBrowser control.

    However, when I go to print, the contents that are displayed in the WebBrowser control will not show up. I have the "Print Object" property set to "True."

    Does anyone know how to fix that?

  4. #4
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2021
    Posts
    974

    Re: Google Maps integration

    Georgy-I started a similar thread several days ago.. http://www.excelforum.com/excel-prog...57#post2670057 I was able to use the final code in that thread to do what I think you are trying to accomplish. Hope it helps!

  5. #5
    Registered User
    Join Date
    12-09-2008
    Location
    Canada
    Posts
    79

    Re: Google Maps integration

    Hey, thanks for the response. I just figured out that I can use Google API as an image to insert into the workbook.

    No need for geocoding, no need for browser controls.

    Awesome!
    http://code.google.com/apis/maps/doc...ex.html#Sensor

    My code for anyone else that may be interested:
    Sub InsertGoogleMapsPictures()
    
        'THIS INSERTS GOOGLE MAPS IMAGES BASED ON PROPERTY ADDRESS
        
        On Error Resume Next
        
        Application.StatusBar = "INSERTING GOOGLE MAPS"
    
        Dim fCell As Range, lCell As Range, rng As Range
        Dim i As Integer, x As Integer
        Dim wsName As String
        Dim wsSummary As Worksheet, wsDest As Worksheet
        Dim picLoc As String
        
        Set wsSummary = Sheets("Portfolio Summary")
        
        With wsSummary
        
            Set fCell = .Cells(4, 1)
            Set lCell = .Cells(65536, 1).End(xlUp)
            Set rng = Range(fCell, lCell)
    
            For i = 1 To rng.Count
                wsName = i & " - " & .Cells(i + 3, 18).Text & " - " & .Cells(i + 3, 1).Text
                Set wsDest = Sheets(wsName)
                With wsDest
                    picLoc = "http://maps.googleapis.com/maps/api/staticmap?size=400x330&maptype=roadmap\&markers=size:mid%7Ccolor:red%7C232+" & .Cells(6, 1).Text & "&zoom=15&sensor=false"
                    .Activate
                    .Pictures.Insert (picLoc)
                    With ActiveSheet.Pictures(ActiveSheet.Pictures.Count)
                        .ShapeRange.LockAspectRatio = False
                        .Top = wsDest.Cells(46, 3).Top
                        .Left = wsDest.Cells(46, 3).Left
                        .Height = wsDest.Cells(71, 3).Top - wsDest.Cells(46, 3).Top
                        .Width = wsDest.Cells(46, 10).Left - wsDest.Cells(46, 3).Left
                        .Placement = xlMoveAndSize
                        .PrintObject = True
                    End With
                End With
            Next i
            
            .Activate
            .Cells(1, 1).Select
            
        End With
    
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1