Add-In to get current map version

Discussion created by pschneider on Jan 7, 2011
Latest reply on Jan 3, 2013 by Peter.G
I'm creating an ArcMap Button add-in (VB.NET) that needs to (among other things) determine what version the current Map Document is (v9.3, v10.0, etc.)  The following code throws an exception; all documentation that I have read indicates that I should be getting these version numbers/values using the .getVersionInfo method.  What have I done wrong?

   Private Sub checkVersion()
        Dim pMapDocument As IMapDocument
        Dim vMissing As Boolean
        Dim vMajor As Integer
        Dim vMinor As Integer
        Dim vRevision As Integer
        Dim vBuild As Integer

        pMapDocument = CType(My.ArcMap.Document, IMapDocument)

            pMapDocument.GetVersionInfo(vMissing, vMajor, vMinor, vRevision, vBuild)
            MsgBox(vMajor & "." & vMinor & "." & vRevision & " " & vBuild)
        Catch ex As Exception
            MsgBox("Didn't work")

        End Try
        verChecked = True

    End Sub