I have a dialog box written in ArcObjects.

I am programming the Map button on the dialog box.

The user picks a type of station and county.

The program goes to folder containing the mxds and opens the one with the same county name.

I need to know how to code for going to folder and then opening the mxd.

My program is listed below :

Dim pWorkspaceName As WorkspaceName
Set pWorkspaceName = New WorkspaceName
Dim pWorkspaceName2 As WorkspaceName2
Set pWorkspaceName2 = New WorkspaceName2
pWorkspaceName.PathName = "K:\TASS\4_MAPPING_DATA_Maps\2012"
pWorkspaceName.PathName2 = "K:\TASS\4_MAPPING_DATA_SUPPORT\Traffic_Mapping\Urban_Maps"

Dim cboStations As String
If cboStations = "Annual" Then pWorkspaceName.PathName

Dim districts As String
Dim cboDistrict As String

If cboDistrict = "Abilene" Then Application.OpenDocument ("K:\TASS\4_MAPPING\Abilene_Base_Map.mxd")
cboDistrict = "Amarillo" then getmxd "K:\TASS\4_ps\2012\Amarillo"
  • 2
    Are you getting an error when you try to run your application? Can you be more specific about the problem you are having?
    – Kevin
    Jan 8, 2013 at 17:07
  • 1
    What is the intended logic, step by step? It is not clear from the code which does not appear to be functional or complete.
    – blah238
    Jan 8, 2013 at 17:15

2 Answers 2


There is a code for Open New Map Document. You can go through this. But it did not work for me.

I have done following code for me. I have no idea about VB. So, I am posting this code in c#. I hope you can convert it for yourself.

void OpenMxd(string mxdPath)
    IMapDocument mapDoc = new MapDocumentClass();
    if (mapDoc.IsPresent[mxdPath] && mapDoc.IsMapDocument[mxdPath] && !mapDoc.IsPasswordProtected[mxdPath])
        IMap map = mapDoc.Map[0];
        ArcMap.Document.ActiveView = map as IActiveView;

Here are two options:

   Dim mapDocument As New MapDocument()

   If mapDocument.isPresent(mapLocation) Then
        mapDocument.open(mapLocation, "")
   End If


You can also use Shell command to open an mxd, see example below (example is not for opening ArcMap, however the concept is the same)

Launching a program/open a file through VBA

  • I am not getting an error because I haven't tried it yet. The logic is to Go to the folder that has the annual maps (they select from the drop down box to specify they want Annual stations so the program then goes to that folder, they also select county name from drop down box and then the program goes to the annual folder and grabs the county name mxd to open it so the user can then look at said map. So the program has to go to a folder first then pick out an mxd to open. Jan 8, 2013 at 17:42
  • The link doesn't help because I am not opening a different document. I am opening an mxd document. Jan 8, 2013 at 18:37
  • @Michelle Couden, You should be able to push the ArcMap.exe and specific mxd file into a Shell command.
    – artwork21
    Jan 8, 2013 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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