View Single Post

  #4 (permalink)  
Old 12-18-2003
Martel 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.
Reply With Quote