VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsVBPModReporter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
' clsVBPRefReporter: Report COM references for VBP file
Option Explicit

Public Event status(ByVal msg As String)

Public Function header() As String
    header = "VBPPATH" & vbTab & "VBPNAME" & vbTab & "MODTYPE" & vbTab & "MODNAME"
End Function

Public Sub processFile(fil As Scripting.File, rpt As Scripting.TextStream)
    
    Const FUNC_NAME$ = "processFile"
    On Error GoTo errorHandler
    
    Dim filpath As String: filpath = fil.ParentFolder.Path
    Dim filname As String: filname = fil.name
    Dim modtype As String
    Dim modname As String
    
    Dim fileSys As FileSystemObject
    Set fileSys = New FileSystemObject
    
    Dim txtfil As Scripting.TextStream
    Set txtfil = openInputText(fil.Path, fileSys)
    
    Dim s As String
    s = txtfil.ReadAll()
    
    Dim arr() As String
    arr = Split(s, vbCrLf)
    
    Dim v As Variant
    For Each v In arr
        
        modtype = ""
        Dim sLine As String
        sLine = LCase$(v)
        
        If ( _
        sLine Like "form=*.frm" Or _
        sLine Like "class=*.cls" Or _
        sLine Like "module=*.bas" Or _
        sLine Like "usercontrol=*.ctl" Or _
        sLine Like "propertypage=*.pag") _
        Then
        
            sLine = v
            
            Dim j As Integer
            Dim i As Integer
            
            i = InStr(sLine, "=") + 1
            
            modtype = Left$(sLine, i - 2)
            
            sLine = Trim$(Mid$(sLine, i)) ' object name; path
            
            j = InStrRev(sLine, ";")
            
            If j = 0 Then j = 1 Else j = j + 1
            
            sLine = Trim$(Mid$(sLine, j)) ' object path
            
            j = InStrRev(sLine, "\")
            
            If j = 0 Then j = 1 Else j = j + 1
            
            modname = Trim$(Mid$(sLine, j)) ' file name

           Call writeRpt(rpt, _
            filpath & vbTab & _
            filname & vbTab & _
            modname & vbTab & _
            modtype & vbCrLf)
    
            
        End If
    
    Next v
    
errorHandler:
    
    If Not txtfil Is Nothing Then txtfil.Close
    Set fileSys = Nothing
    Set txtfil = Nothing
    
    If Err Then _
        Err.Raise Err.Number, Description:=TypeName(Me) & "::" & FUNC_NAME$ & " " & _
        vbCrLf & "[" & fil.Path & "]" & _
        vbCrLf & Err.Description
        
End Sub




