Toolbar Button to Run VBA Macro in All of my ArcMap Maps

2565
1
04-06-2012 11:36 AM
DanWolford
New Contributor II
I have a VBA macro named "Normal.ThisDocument.ProportionSplit" that will take input (a column of asbuilt lengths) from Excel and then proportionately split a polyline into the appropriate lengths proportionately (I have ArcView not Editor or Info that is why I am doing this).  The code I have currently works and does what I need it to do.  I want to make this VBA macro run from a toolbar button (preferably with a custom image rather than a smiley face) that will be accesible in every ArcMap document/Map that I have (ie everytime I run the program).  I can very easily create a button that will work in my current map by just Customize->Customize Mode ->Commands Tab ->[Macros]->Normal.ThisDocument.ProportionSplit and dragging this macro to the toolbar.  The problem is that this button will only be availble in the current Map and not subsequent maps that I create unless I repeat this process.  Do I need to recreate this project in Visual Studio? Or is there another way.

I have Visual Basic Express 2008 and 2010.  I also have the ArcObjects SDK installed, but I installed it prior to Installing Visual Basic Express 2008 so the Arc Templates aren't present.

Thanks for any and all help.

Dan
0 Kudos
1 Reply
JeffreyHamblin
New Contributor III
Hi Dan,

In ArcGIS 9, you can put your vba code and button in the Normal template, which makes it global. But that is no longer supported starting at ArcGIS 10. So if you're using 10, you need to create an Add-In. You indicate you're using the Express edition of Visual Studio, so you will have to use VS 2008, since that's what the SDK installer supports. You should be able to simply reinstall the SDK to get the ArcGIS templates into VS.
0 Kudos