Community of VE/MapPoint Users and Developers
This is a discussion on Using MapPoint from Word, Access and Excel within the MP2K Magazine Articles forums, part of the Map Forums category; This article contains code snippets that allows you to seamlessly drop a map graphic into your Word, Access or Excel ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Using MapPoint from Word, Access and Excel Read the full article: http://www.mp2kmag.com/articles.asp?ArticleID=39 |
| |||
| Re: Using MapPoint from Word, Access and Excel Quote:
|
| |||
| Using MapPoint from Word, Access and Excel
Nevermind, I didn't have the proper references checked. Works pretty good! I was wondering, do you know of a more general script that will work with any highlighted text? Or of a macro that will autolauch Mappoint with the address in highlighted? Thanks. |
| |||
|
I had some difficulty with acCmdPaste in the Access app. I can get it to run just fine in Access 97, but it usually won't paste in Access 2002. When this happens the app locks up until I give it the 3 finger salute. I've fixed the lockups with error handling. I've also added an API to do the pasting. This usuall (but not always) works. Here's my modifications: Private Sub cmdMap_Click() Dim oApp As Object, oMap As Object, oPush(1 To 2) As Object, oLoc(1 To 2) As Object Set oApp = CreateObject("Mappoint.Application") Set oMap = oApp.NewMap Set oLoc(1) = oMap.Find(Address & " , " & City & " , " & State) Set oLoc(2) = oMap.Find(Address2 & " , " & City2 & " , " & State2) If Not oLoc(1) Is Nothing Then Set oPush(1) = oMap.AddPushpin(oLoc(1)) oPush(1).GoTo If Not IsNull(MyName) Then oPush(1).Name = MyName oPush(1).Highlight = True If Not oLoc(2) Is Nothing Then Set oPush(2) = oMap.AddPushpin(oLoc(2)) oPush(2).Highlight = True With oMap.ActiveRoute .Waypoints.Add oLoc(1) .Waypoints.Add oLoc(2) .Calculate End With 'oMap.CopyDirections 'txtDir.SetFocus 'RunCommand acCmdPaste ' substituting these lines oMap.CopyDirections DoEvents Me.txtDir.SetFocus Me.txtDir = GetData() Else txtDir.SetFocus txtDir.Text = "No second location found!" End If oMap.DataSets(1).ZoomTo oMap.CopyMap imgClip.Visible = True imgClip.Action = acOLEPaste lblMapInfo.Caption = "" Else lblMapInfo.Caption = "Address Not Found!" End If ' Take these out 'Set oMap = Nothing 'Set oApp = Nothing 'Me.SetFocus 'End Sub 'Then add error handling Exit_Here: Set oMap = Nothing oApp.Quit Set oApp = Nothing Me.SetFocus Exit Sub Error_Handler: MsgBox Err.Number & ": " & Err.Description Resume Exit_Here End Sub Unfortunately oApp.Quit opens MapPoint, but it does keep an instance from running in memory, which I believe is the reason it won't always paste. The API is at: http://support.microsoft.com/?id=138910 and I rewrote the Clipboard_GetData() function similar to Dev Ashish's code at: http://www.mvps.org/access -- Arvin Meyer, MVP Microsoft Access |
![]() |
| Tags |
| access, excel, mappoint, word |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pasting a Mappoint Legend into MS Word 2003 | Eric B | Wish List | 0 | 08-18-2005 04:44 PM |
| Cut and Paste Problem with Word 2003 and MapPoint 2004 | brubli | MapPoint 2006/2009 Discussion | 0 | 10-21-2004 05:26 PM |
| Mail Merge using MapPoint 2004 and Word 2003 | fibble9 | MapPoint 2006/2009 Discussion | 0 | 04-14-2004 05:29 PM |
| When working with mappoint and coping to word how .... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 06-28-2002 09:20 AM |
| 10 Second Tutorial: Embedding With Word | Anonymous | MP2K Magazine Articles | 0 | 07-01-2001 12:48 AM |