MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Using MapPoint from Word, Access and Excel

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


Go Back   MapPoint Forums > Map Forums > MP2K Magazine Articles

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-16-2001
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Using MapPoint from Word, Access and Excel

This article contains code snippets that allows you to seamlessly drop a map graphic into your Word, Access or Excel documents anywhere you have a valid address.

Read the full article: http://www.mp2kmag.com/articles.asp?ArticleID=39
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 10-02-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Using MapPoint from Word, Access and Excel

when creating the macro, I get the compile error message "User defined type not defined". I am using Word 2000 and Mappoint 2000.
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 10-02-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Re: Using MapPoint from Word, Access and Excel

Quote:
Originally Posted by macd
when creating the macro, I get the compile error message "User defined type not defined". I am using Word 2000 and Mappoint 2000.
Sorry, my version of Mappoint is 2002. The line in the module is 'Dim oApp As MapPoint.Application'
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 10-02-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 11-26-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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
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

Tags
access, excel, mappoint, word


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


All times are GMT -5. The time now is 01:31 PM.


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


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 52 53 54