|
发表于 2024-10-16 12:57
来自手机
|
显示全部楼层
本帖最后由 lss001 于 2024-10-16 13:10 编辑
Sub Workbook_Open()
Dim vbp As Object, vbc As Object
Dim vName$, hName$, k&, x&, y&
MsgBox "提示:即将自动删除本代码!"
Set vbp = ActiveWorkbook.VBProject
Set vbc = vbp.vbcomponents("ThisWorkbook")
vName = "Workbook_Open"
With vbc.CodeModule
k = .CountOfDeclarationLines + 1
While k < .CountOfLines
hName = .ProcOfLine(k, 0)
x = .ProcStartLine(hName, 0)
y = .ProcCountLines(hName, 0)
k = x + y
If hName = vName Then
Call .DeleteLines(x, y)
End If
Wend
End With
End Sub |
|