Hi all, Need help with some debugging. I m using this FindLayerByName function to set my layer with its name. Just in case, this layer is not available in TOC, how do i handle that error ?
sub()
Set pFeatLayer = FindLayerByName(pMap, "Road1")
Set pDispTable = pFeatLayer
Set pFCLayer = pDispTable.DisplayTable
Set pTLayer = pFCLayer
End Sub
Function FindLayerByName(pMap As IMap, sName As String) As ILayer
Dim i As Integer
For i = 0 To pMap.LayerCount - 1
If pMap.Layer(i).name = sName Then
Set FindLayerByName = pMap.Layer(i)
End If
Next
End Function
Regards,Priyanka