|
Sub ReadCode()
Sheet1.Columns("J:J").ClearContents
Sheet1.Columns("M:M").ClearContents
Sheet1.Columns("P:P").ClearContents
i = 1
Dim varLines() As String
Dim strTmp As Variant
With Application.VBE.VBProjects(1).VBComponents(Sheet1.Name).CodeModule
varLines = Split(.Lines(1, .CountOfLines), vbCrLf)
End With
For Each strTmp In varLines
Sheet1.Cells(i, "J") = strTmp
i = i + 1
Next strTmp
i = 1
With Application.VBE.VBProjects(1).VBComponents(Sheet3.Name).CodeModule
varLines = Split(.Lines(1, .CountOfLines), vbCrLf)
End With
For Each strTmp In varLines
Sheet1.Cells(i, "M") = strTmp
i = i + 1
Next strTmp
i = 1
With Application.VBE.VBProjects(1).VBComponents("模块1").CodeModule
varLines = Split(.Lines(1, .CountOfLines), vbCrLf)
End With
For Each strTmp In varLines
If strTmp = "Sub AACC()" Then wr = 1
If strTmp = "End Sub" Then
Sheet1.Cells(i, "P") = strTmp
wr = 0
End If
If wr = 1 Then
Sheet1.Cells(i, "P") = strTmp
i = i + 1
End If
Next strTmp
End Sub |
|