Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Can anyone tell me how to accomplish this? I want a Python script to run on opening the MXD which would pull an excel worksheet into a GDB and refresh the map. I only want this to happen in this specific MXD.

Thanks

share|improve this question
    
I remember writing a VBA program that integrated this functionality. So it should be possible in Python. –  jvangeld Jun 8 '11 at 18:21
    
@gg7aph Did you ever find a solution to this issue? –  om_henners Jun 25 '12 at 2:45
add comment

4 Answers 4

If you are going to ArcMap 10.1 you could create a python add-in. The add-in gives you access to an "on open" function that will run code when you open the mxd.

The help here explains how to create one and has a sample that adds a base layer to the mxd when opening.

share|improve this answer
add comment

You could code within the VBA of the mxd and call the python script within the code wrapper below:

Private Function MxDocument_OpenDocument() As Boolean

End Function
share|improve this answer
add comment

In 10.0, you could use VBA as in artwork21's answer, or write a very simple ArcMap add-in using ArcObjects to run a script tool or shell out to arbitrary executables/scripts on startup, as in this answer.

It would probably be worth waiting for 10.1's Python add-ins if you don't want to write an ArcObjects add-in specifically for this.

share|improve this answer
add comment

Good Question. A possible continuation to artwork21's answer can be found Here but I haven't tried it yet - it's a bit of a workaround, but it sounds promising.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.