Version Control - Obtain version numbers of all modules within a modular workbook

Version ControlAPI
2 posts / 0 new
Last post
Khang A+ 1
Version Control - Obtain version numbers of all modules within a modular workbook

Hi Everyone,

This is my first post in here.

Is there any quick/easy way (VBA even) to obtain a list of the version numbers of every module within a modular workbook?

Other than going into the Project Manager and manually noting them down.

Thanks.

Michael Hutchens A+ 189

Hi Khang,

You can do this easily in VBA using the Modano API, which you can download using this link: www.modano.com/api/latest

There's lots of examples in there, but here's an example of a routine which loops through all modules in the open modular workbook and prints their version numbers into the VBA Immediate Window:

Sub Get_All_Module_Versions()

    'Demonstrates how to get the versions of all modules in the active modular workbook.
    
    'Private declarations:
    Dim fContinue As Boolean
    Dim modappConnection As New ModanoApplication
    Dim mwbActive As ModulesWorkbook
    Dim rgmodWorkbook As Modules
    Dim crgmodWorkbook As Long
    Dim irgmodWorkbook As Long
    Dim modWorkbook As ModanoModule
    
    'Checks for valid connection:
    fContinue = modappConnection.ValidConnection(Nothing, False)

    'Gets the active module:
    If fContinue Then
        Set mwbActive = modappConnection.ActiveModulesWorkbook
        If (mwbActive Is Nothing) Then
            Call MsgBox("Activate a modular workbook.", vbInformation, "Modano API")
        Else
            Set rgmodWorkbook = mwbActive.Modules
            crgmodWorkbook = rgmodWorkbook.Count
            If (crgmodWorkbook < 1) Then
                Call MsgBox("The active modular workbook does not include any modules.", vbInformation, "Modano API")
            Else
                For irgmodWorkbook = 1 To crgmodWorkbook
                    Set modWorkbook = rgmodWorkbook.Item(irgmodWorkbook)
                    Debug.Print ("Module: " & modWorkbook.Name & " -> Version: " & modWorkbook.Version)
                Next irgmodWorkbook
            End If
        End If
    End If

End Sub

The API can be used to do a huge number of things like this, both getting and setting properties of most objects within modular workbooks and the modules within them.