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.

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
    
Are you using ArcCatalog? –  Emi Jan 13 '13 at 6:38
    
IApplication.OpenDocument Method does not work in ArcCatalog according to: help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/… –  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
add comment

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.

1 Answer

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.

ADDITION:

It is not tested

string cboStations;
string cboDistrict;

ESRI.ArcGIS.Framework.IApplication theMap = ArcMap.Application;
if (cboDistrict == "Abilene") 
   theMap.OpenDocument(@""K:\TASS\4_MAPPING_DATA_SUPPORT\Traffic_Mapping\District_Maps\2012\Abilene\Abil‌​ene_Base_Map.mxd""); 
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 VB.net. 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
add comment

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