Sub and Function not defined??

501
2
01-14-2013 11:00 AM
MichelleCouden1
Occasional Contributor III
My code error is sub and function not defined, when the command Map button is pushed!! Trying to understand VBA, not to sure what that means. My code is below please help!!

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")
    ElIf
        MsgBox "District Does Not Exist"
    End If
0 Kudos
2 Replies
MarcinDruzgala
Occasional Contributor
My code error is sub and function not defined, when the command Map button is pushed!! Trying to understand VBA, not to sure what that means. My code is below please help!!

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")
    ElIf
        MsgBox "District Does Not Exist"
    End If


Same question everywhere, are you some kind of gis-troll?

http://forums.arcgis.com/threads/75211-Code-seems-to-be-caught-in-Loop!!
http://forums.arcgis.com/threads/74858-VBA-Help-with-Subroutines-and-Functions
http://forums.arcgis.com/threads/74687-Path-to-folder-and-mxd - answered !!
http://forums.arcgis.com/threads/74760-Code-for-going-to-Folder-and-Drawing-an-mxd-from-that-Folder!... - answered!
http://forums.arcgis.com/threads/74781-Command-for-accessing-and-Opening-Folder-to-have-access-to-mx...
http://gis.stackexchange.com/questions/48038/help-with-loop-my-program-seems-to-be-stuck-in-loop - closed with good explanation why, maybe you should read it.
http://gis.stackexchange.com/questions/46634/how-to-define-subroutines-and-functions - again asnwered....
http://gis.stackexchange.com/questions/46888/setting-a-path-to-a-variable-to-be-able-to-open-a-new-m... - .....
http://gis.stackexchange.com/questions/46634/how-to-define-subroutines-and-functions - agaaaaaaaaaaaaaaaaaaaaain and again

It's propably like a basic question, but you are asking it in wrong way. Just read what people are writing in their posts under your threads, that would help you a lot.

Regards,
MDruzgala
0 Kudos
LeoDonahue
Occasional Contributor III
Try googling for your error message?

Google + "sub or function not defined" = http://msdn.microsoft.com/en-us/library/s8y42ktc%28v=vs.80%29.aspx
0 Kudos