‘ Take 3 List Box in Your Form and 1 command Button
Private Sub Command1_Click()
‘ Enter Your Project FileName
TransferProjectDetails (“TEST.vbp”)
End Sub
Public Function TransferProjectDetails(ProjectVbpFile As String) As Boolean
Dim ln As Integer ‘ for lineno
Dim opos As Integer ‘for opening position
‘On Error GoTo errlbl
TransferProjectDetails = False
Dim TextLine
If Len(ProjectVbpFile) = 0 Then
ProjectVbpFile = “\project1.vbp”
Else
ProjectVbpFile = “\” & ProjectVbpFile
End If
Open App.Path & ProjectVbpFile For Input As #1 ‘ Open file.
Open App.Path & “\ProjectFileDetails.txt” For Output As #2 ‘ Open file.
Do While Not EOF(1) ‘ Loop until end of file.
ln = ln + 1
Line Input #1, TextLine ‘ Read line into variable.
Debug.Print ln & ” ” & TextLine ‘ Print to the Immediate window.
If InStr(1, TextLine, “Sub”) > 0 Then
opos = ln
Print #2, ln & ” ” & TextLine ‘TextLine
ElseIf InStr(1, TextLine, “Form=”) = 1 Then
” = 1 means it gets only forms filenames. not name of the forms name property
Print #2, ln & ” ” & TextLine
fname = Right(TextLine, Len(TextLine) – (InStr(TextLine, “=”)))
List1.AddItem fname
ElseIf InStr(1, TextLine, “Module=”) = 1 Then
Print #2, ln & ” ” & TextLine
Mfname = Right(TextLine, Len(TextLine) – (InStr(TextLine, “;”)))
List2.AddItem Mfname
‘print #2,
ElseIf InStr(1, TextLine, “Class=”) > 0 Then
Print #2, ln & ” ” & TextLine
Cfname = Right(TextLine, Len(TextLine) – (InStr(TextLine, “;”)))
List3.AddItem Trim(Cfname)
‘print #2,
End If
Loop
Close #1 ‘ Close file.
Close #2
TransferProjectDetails = True
Exit Function
errlbl:
MsgBox Err.Description
TransferProjectDetails = False
End Function