Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How to define Subroutines and functions?

I know its strange but I need to be able to open a new mxd into an existing one. Yes, it can be done. All I need to do is set a path to a variable(most likely iApplication). From dialog box, user selects a district name to open that districts mxd. I believe the code would be Application.iApplication.OPenDocument(Path to folder). But I am having trouble with the sub and function declaration. It keeps giving me an error of sub and function not declared. Sample is below : Private Sub cmdMap_Click()

Dim District As String
Dim map As mapDocument
Set map = New mapDocument

map.District = ComboBox("Abilene")

Call DrawTasks.RenderMap("Abilene")

Application.IApplication.OpenDocument ("K:TASS......")

End Sub

share|improve this question

marked as duplicate by whuber Jan 14 '13 at 22:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Are you using ArcCatalog? – Emi Jan 13 '13 at 6:38
IApplication.OpenDocument Method does not work in ArcCatalog according to:… – Emi Jan 13 '13 at 6:39
What do you want to do once you 'open' it? Do you need to just read things from it, or cause it to Open in a new ArcMap window? – Devdatta Tengshe Jan 13 '13 at 6:51
Michelle, you seem to be asking exactly the same question over and over again. Please just respond to the requests to clarify the original question. More info about how this site works is available at our faq. – whuber Jan 14 '13 at 22:42

I am not sure, but isn't IMapDocument.Open Method used toopen an ".mxd"? Maybe you can read the documentation for this method. It may help you.


It is not tested

string cboStations;
string cboDistrict;

ESRI.ArcGIS.Framework.IApplication theMap = ArcMap.Application;
if (cboDistrict == "Abilene") 
share|improve this answer
Devdatta!! All the reader needs to do is look at the map document no editing will be available. Correct Emi!! I am having trouble using the iApplication though. I am not understanding why my sub and function are not working!! Here's my new code.Dim cboStations As String Dim cboDistrict As String Dim theMap As mapDocument Set theMap = New mapDocument If cboDistrict = "Abilene" Then IApplication.OpenDocument ("K:\TASS\4_MAPPING_DATA_SUPPORT\Traffic_Mapping\District_Maps\2012\Abilene\Abil‌​ene_Base_Map.mxd") Elif End – Michelle Couden Jan 14 '13 at 19:38
I never worked with So, I don't know if there is any problem with your declarations. – Emi Jan 15 '13 at 4:11
I have edited my answer. You can go through this. – Emi Jan 15 '13 at 4:32

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