Code seems to be caught in Loop!!

01-14-2013 10:26 AM
Occasional Contributor III
I think my code (VBA/ArcObjects) is stuck in a loop and won't end. I hit the Map button on my dialog box and nothing happens???? Please let me know where I went wrong.

Private Sub cmdMap_Click()

    Dim cboStations As String
    Dim cboDistrict As String
    Dim mapDocument As IMapDocument
    Set mapDocument = New mapDocument
    If mapDocument.IsPresent("K:\TASS\4_MAPPING_DATA_SUPPORT\Traffic_Mapping\District_Maps\2012\Abilene\Abilene_Base_Map.mxd") Then
    mapDocument.Open ("K:\TASS\4_MAPPING_DATA_SUPPORT\Traffic_Mapping\District_Maps\2012\Abilene\Abilene_Base_Map.mxd")
    End If

End Sub
0 Kudos
1 Reply
by Esri Contributor
Esri Contributor

The most probably cause of the problemfor your code becoming unresponsive is that it is not able to open the specified map document. This could be because it does not exist; the user logged in does not have permissions to read/write that folder location; or the map document is broken/corrupted.

It should be noted that ESRI no longer supports VBA. Please migrate all your VBA customizations to ArcObjects .NET. You can choose between VB.NET and C#. Please give the following documentation a read to help with the migration:

Migrating VBA Customizations to ArcGIS 10.1

0 Kudos