编辑文档时是否有事件?如果没有,有谁知道我在哪里可以找到可用 VBA 事件的列表?
joe
问问题
3160 次
4 回答
2
Here are the events for the document object:
http://msdn.microsoft.com/en-us/library/aa140279(office.10).aspx
Events
DocumentBeforeClose : Immediately before any open document closes.
DocumentBeforePrint : Before any open document is printed.
DocumentBeforeSave : Before any open document is saved.
DocumentChange : A new document is created, when an existing document is opened, or when another document is made the active document.
DocumentOpen : A document is opened.
EPostageInsert : A user inserts electronic postage into a document.
EPostagePropertyDialog : A user clicks the E-postage Properties (Labels and Envelopes dialog box) button or Print Electronic Postage toolbar button. This event allows a third-party software application to intercept and show their properties dialog box.
MailMergeAfterMerge : After all records in a mail merge have merged successfully.
MailMergeAfterRecordMerge : After each record in the data source successfully merges in a mail merge.
MailMergeBeforeMerge : A merge is executed before any records merge.
MailMergeBeforeRecordMerge : As a merge is executed for the individual records in a merge.
MailMergeDataSourceLoad : The data source is loaded for a mail merge.
MailMergeDataSourceValidate : A user performs address verification by clicking Validate in the Mail Merge Recipients dialog box.
MailMergeWizardSendToCustom : The custom button is clicked on step six of the Mail Merge Wizard.
MailMergeWizardStateChange : A user changes from a specified step to a specified step in the Mail Merge Wizard.
NewDocument : A new document is created.
Quit : The user quits Word.
WindowActivate : Any document window is activated.
WindowBeforeDoubleClick : The editing area of a document window is double-clicked, before the default double-click action.
WindowBeforeRightClick : The editing area of a document window is right-clicked, before the default right-click action.
WindowDeactivate : Any document window is deactivated.
WindowSelectionChange : The selection changes in the active document window.
WindowSize : The application window is resized or moved.
There are also Auto Macros:
AutoNew, AutoOpen, AutoExec, AutoExit
于 2008-11-06T16:27:55.843 回答
1
命令是 WindowSelectionChange
于 2009-01-05T18:13:29.140 回答
0
要拦截任何 Word 命令,您可以:
1.
按 Alt+F8 调出“宏”对话框,在显示“宏输入”的位置,选择“字命令”。
2.
查找并选择您要拦截的命令之一——例如,要拦截您需要查找 FilePrint 和 FilePrintDefault 的打印命令。要拦截保存命令,您需要找到 FileSave、FileSaveAs 和 FileSaveAll
3.
在显示“宏”的位置,选择要存储宏的模板,然后单击“创建”。
4.
执行命令所需的代码将为您编写;只需添加您自己的代码。
于 2008-11-07T15:26:08.717 回答
0
您可以尝试使用 autohotkey 来监听按键事件,看看我的代码:
于 2015-07-21T08:40:28.107 回答