如题,VBA写法如下
Public WithEvents appWord as Word.Application/Private Sub appWord_DocumentBeforeClose _
(ByVal Doc As Document, _
Cancel As Boolean) Dim intResponse As Integer intResponse = MsgBox("Do you really " _
& "want to close the document?", _
vbYesNo) If intResponse = vbNo Then Cancel = True
End Sub
转为JS 应该如何写?
Public WithEvents appWord as Word.Application/Private Sub appWord_DocumentBeforeClose _
(ByVal Doc As Document, _
Cancel As Boolean) Dim intResponse As Integer intResponse = MsgBox("Do you really " _
& "want to close the document?", _
vbYesNo) If intResponse = vbNo Then Cancel = True
End Sub
转为JS 应该如何写?
a下面的属性或方法按vba里的来做
vba中 是使用withevents 来直接绑定该对象,
js中 无法使用withevents 关键字。只要能够触发到word关闭事件就好了,但是不能用active组件;