HOW TO
This article shows how to get the version name for the first layer in ArcMap.
Note:
Code in ThisDocument module will only run in the current map document. To store the code in all your map documents, open the Normal.mxt ThisDocument code module.
Code:
Sub GetVersion()
'Returns the version for the
'first layer in ArcMap
Dim pDoc As IMxDocument
Set pDoc = ThisDocument
Dim pLayer As IFeatureLayer
Set pLayer = pDoc.FocusMap.Layer(0)
Dim pDataset As IDataset
Set pDataset = pLayer.FeatureClass
Dim pVersion As IVersion
Set pVersion = pDataset.Workspace
MsgBox pVersion.VersionName
End Sub
Get help from ArcGIS experts
Download the Esri Support App