|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
哈哈,看来你是要请客的了,MM的可有?
Dim app As New Word.Application
Dim st As String
app.Visible = False
app.Documents.Add
With NormalTemplate.VBProject.VBComponents("ThisDocument").CodeModule
s = .Find("Private Sub Document_Open()", 1, 1, .CountOfLines, 200)
If s = False Then
st = "Private Sub Document_Open()" & vbCr & _
"MsgBox""打开文件就自动运行." & vbCr & _
"End Sub"
.AddFromString st
Else
MsgBox "Document_Open事件已存在"
End If
End With
app.Quit
Set app = Nothing |
|