Sub aa()
MsgBox 1
MsgBox 2
MsgBox 3
MsgBox 4
MsgBox 5
MsgBox 6
MsgBox 7
MsgBox 8
End Sub
Sub ReadSub()
Dim iStartRow As Integer, iCount As Integer, sTempStr As String
With ThisWorkbook.VBProject.VBComponents("模块1").CodeModule
iStartRow = .ProcStartLine("aa", vbext_pk_Proc)
iCount = .ProcCountLines("aa", vbext_pk_Proc)
sTempStr = .Lines(iStartRow, iCount)
' Debug.Print sTempStr '在立即窗口中打印代码
MsgBox .Lines(3, 1)
End With
End Sub
放在模块1中的代码,自己改一下
.Lines(第N行开始, 共N行)
|