[V8i-SS2 VBA] reading variable from un-opened VBA Projects

Hi Folks,

I am writing a utility to  read utility versions for all my MVBA Projects. Will I need to open all in this code in order to do this?

I have highlighted where I got to so far.


' ---------------------------------------------------------------------
'   GetToolVersions
'   Lists all strVERSION values for all MVBA Utilities
'   Set a reference to the Microsoft Visual Basic for Applications
'   Extensibility 5.3 library (in Tools | References...)
'   VBIDE is the code name of this library.
' ---------------------------------------------------------------------
Public Sub GetToolVersions()
    '   Check for KeyinArguments
    Dim args()              As String
    Dim nArgs               As Integer
    args = Split(application.KeyinArguments, ",")
    nArgs = 1 + UBound(args) - LBound(args)
    If (1 < nArgs) Then
        Dim UName           As String
        Dim PWord           As String
        UName = args(1)
        PWord = args(2)
        '   Wrong number of arguments
    End If
    '   Prepare code project definitions
    Dim oVBE                As VBIDE.VBE
    Set oVBE = VBE
    Dim oProject            As VBIDE.VBProject
    Dim oProjects           As VBIDE.VBProjects
    Set oProjects = VBE.VBProjects
    Dim vbaAutoloads        As String
    Dim vbaProjects()       As String
    '   VBA requires the following as a variant and not a string
    Dim vbaProject          As Variant
    '   Get an array of AutoLoad VBA Project Names
    With ActiveWorkspace
        If .IsConfigurationVariableDefined("MS_VBAAUTOLOADPROJECTS") Then
            vbaAutoloads = .ConfigurationVariableValue("MS_VBAAUTOLOADPROJECTS", True)
        End If
        If .IsConfigurationVariableDefined("MS_VBAREQUIREDPROJECTS") Then
            vbaAutoloads = vbaAutoloads & ";" & .ConfigurationVariableValue("MS_VBAREQUIREDPROJECTS", True)
        End If
    End With
    vbaProjects = Split(vbaAutoloads, ";")
    '   Check each VBA project from list of AutoLoad VBA's
    Dim Count               As Long
    For Each vbaProject In vbaProjects
        '   Get MVBA as path and fullname
        Dim strName         As String
        Dim arrNames()      As String
        Dim intIndex        As Integer
        Dim PrjName         As String
        Dim strVersion      As String
        strName = vbaProjects(Count)
        arrNames = Split(strName, "\")
        intIndex = UBound(arrNames)
        PrjName = arrNames(intIndex)
        Debug.Print "File name: " & PrjName
        '   Get Procedure > Module constant strVERSION
        Dim oProj As VBProject
        Set oProj = vbaProject
        strVersion = oProj.EE_Header.strVersion
        Debug.Print "Version: " & strVersion
        Count = 1 + Count
    Next vbaProject
End Sub

Parents Reply Children
No Data