Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 7 of 7

Mappoint 2k and boundaries

This is a discussion on Mappoint 2k and boundaries within the MapPoint Desktop Discussion forums, part of the Map Forums category; Is there any way to combine seperate maps with seperate yellow boundaries (areas to avoid) into one map without having ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Mappoint 2k and boundaries

    Is there any way to combine seperate maps with seperate yellow boundaries (areas to avoid) into one map without having to copy and paste every single manually drawn boundary from one map to another?

    Thanks to anyone who can help me with this!
    bwinkeler@scholasticbookfairs .com

  2. #2
    Martel is offline Junior Member Yellow Belt
    Join Date
    Feb 2003
    Posts
    28
    Assuming you have access to some Microsoft Office product:

    This is not elegant, but will work in Word, Excel or Access in Office XP or 2003. I am not sure about 2000 because this uses the Application.FileDialog box which was not accessible in earlier Office versions.

    If you are a VBA Wiz then skip this and go on to the code, otherwise:
    In Word or Excel you will need to go Tools > Macro > Visual Basic Editor and insert a module. Copy and paste the code into the module. From the visual basic editor window, go to Tools > References and in the dialog box that pops up, check the box next to Microsoft MapPoint 9.0 Object Library (or whatever your version is). Save the module. Run the module by pressing F5 while the Visual Basic Editor is the active window.

    The same basic stuff will work in Visual Basic, with the exception of the FileDialog, you will need to replace it with the CommonDialog control or some other way of getting the file paths and names.


    Code:
    Private Sub CopyShapes()
       'general variables
       Dim srcFile As String
       Dim targFile As String
       Dim selItem As Variant
     '  Dim mpYellow As Long
       'mappoint variables
       Dim MPApp1 As MapPoint.Application
       Dim MPApp2 As MapPoint.Application
       Dim MPMap1 As MapPoint.Map
       Dim MPMap2 As MapPoint.Map
       Dim MPShape As MapPoint.Shape
       'application variables
       Dim FD As FileDialog
       
      ' mpYellow = &HFFFF&
       
       'set up file dialog and get source file name
       Set FD = Application.FileDialog(msoFileDialogFilePicker)
       FD.AllowMultiSelect = False
       FD.Filters.Clear
       
       FD.Filters.Add "MapPoint Files", "*.ptm"
       
       'select target file
       With FD
          .Title = "Select the file to which you want to copy:"
          If .Show = -1 Then
              For Each selItem In FD.SelectedItems
                 targFile = selItem
              Next
          Else
            'user pressed cancel, no file to process so exit
            Exit Sub
          End If
       End With
       
       'initialize target map
       Set MPApp1 = CreateObject("Mappoint.Application")
       Set MPMap1 = MPApp1.OpenMap(targFile, False)
     
       'you might want to put this at the end
       'the map spins and moves around a lot as the
       'copy work is being done
       'disadvantage to moving to the end is if an error occurs
       'MapPoint will run in the background unless you kill it in the 
       'task manager
       MPApp1.Visible = True
       MPApp1.UserControl = True
       
       Application.Activate
       'select source files
       With FD
          .AllowMultiSelect = True
          .Title = "Copy shapes from:"
          If .Show = -1 Then
              For Each selItem In FD.SelectedItems
                 srcFile = selItem
     
       
              Set MPApp2 = CreateObject("Mappoint.Application")
              Set MPMap2 = MPApp2.OpenMap(srcFile, True)
              MPApp2.Visible = True
              MPApp2.UserControl = True
    
              'this part will make you dizzy if you choose to 
              'make the applications visible
              For Each MPShape In MPMap2.Shapes
                 If MPShape.Type = geoFreeform Or geoAutoShape Then
                    MPShape.Copy
                    MPMap1.Paste
                 End If
              Next
    
                Next
          Else
            'user pressed cancel, no file to process so exit
            Exit Sub
          End If
       End With
       'clean up
       
       Set MPApp1 = Nothing
       Set MPApp2 = Nothing
       
       Set MPMap1 = Nothing
       Set MPMap2 = Nothing
       
       Set MPShape = Nothing
       Set FD = Nothing
    End Sub

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Thanks!....but

    Here is alittle more info. We are using Windows 2000 pro, office 2000, and mappoint 2002 and a program called Direct Route from Appian Logistics.

    Will your above code work in this setup? I can get all the way to save the module and press f5 to run the module and a macro box pops up. I don't know what to do here and how do I get this to tie into mappoint 2002 to copy my boundaries?

    Thanks again for your help!
    bwinkeler@scholasticbookfairs.com

  4. #4
    Martel is offline Junior Member Yellow Belt
    Join Date
    Feb 2003
    Posts
    28
    Sorry, I left a few steps out and made a mistake. Change the Private to Public in the first line:
    Code:
    Public Sub CopyShapes()
    This will then show up as an available macro when you press F5 while in the Visual Basic editor or select Tools > Macros > Run Macro from the application toolbar (if you are running from Word or Excel for example).

    I have this as an add-in that you can run directly from MapPoint so that you don't have to open and close files. I just can't guarantee that it won't conflict with something else you are running. Running the macro takes an extra few steps, but should work pretty reliably.

    Now, when you have made the above change and saved the file, either press F5 or select run macro. You should see CopyShapes as an available macro. This is where things may not work with Office 2000. Run it and you should get a dialog box prompting you to select the file to which you want to copy the shapes. (I can't remember if Office 2000 supports the FileDialog objectj or if 2002/XP was the version it became developer-friendly). This is the destination file. Once you have selected the destination file, you will receive a prompt to select the source files. You may select more than one file as long as all the files you select reside in the same directory.

    So you might select AllZones as a newly created, blank map. You might then select Zone1, Zone2, and Zone3 as the source maps. The macro will copy all shapes that are freeform or autoshapes from Zone1, Zone2 and Zone3 to AllZones. All of the maps will stay open so that you can make sure that everything is copied correctly.

    If the above works and you want to specify just boundaries filled with yellow, you need to remove the apostrophe before mpYellow = &HFFFF& and change the line
    Code:
    If MPShape.Type = geoFreeform Or geoAutoShape Then
    to
    Code:
     If MPShape.Fill.ForeColor = mpYellow And (MPShape.Type = geoFreeform Or geoAutoShape) Then
    Now, if after all that, you find that the dialog box doesn't work with Office 2000 and you aren't running any MapPoint Add-ins I can send you my utility functions. I have no error checking because I only use it to make repetitive tasks easier and I'm the only person using it. It copies shapes and lines, shows/hides balloons and names by dataset, changes line colors in bulk, etc.

  5. #5
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Help us Martel

    Please send me an email address so I can send you our phone # here at Scholastic Book Fairs and we can talk while I go thru this step-by-step. We can't get your code to work!

    Thanks
    bwinkeler@scholasticbookfairs.com

  6. #6
    Martel is offline Junior Member Yellow Belt
    Join Date
    Feb 2003
    Posts
    28
    Let me add some things to my add-in and I will send it to you along with some instructions.

  7. #7
    Martel is offline Junior Member Yellow Belt
    Join Date
    Feb 2003
    Posts
    28
    You should receive a link by e-mail with some instructions on how to add and test the add-in. See if it will run for you. If you have problems (you may receive some error like "Cannot find COMCTL32.dll" or "Wrong version COMCTL32.ocx" or something along those lines) contact me through e-mail and I will use a different version. I was trying to keep the file small. Nothing like version compatibility issues

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Territory Boundaries
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 05-20-2004, 05:48 PM
  2. Showing all MSA boundaries on USA map
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 05-18-2003, 05:51 PM
  3. MapPoint 2003 and census 2000 tract boundaries
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 04-20-2003, 07:03 AM
  4. Importing 2000 Census boundaries into MapPoint
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 12-13-2002, 06:36 PM
  5. Will MapPoint include UK political boundaries, par....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-26-2001, 08:44 AM

Tags for this Thread

Posting Permissions

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


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 55 56 57 58 59 60 61 62 63 64 65 66