BeforeRefresh 事件 (Excel)QueryTable.BeforeRefresh event (Excel)

在刷新查询表之前产生此事件。Occurs before any refreshes of the query table. 这里的刷新包括调用 Refresh 方法引起的变化,用户的操作引起的变化和打开包含该查询表的工作簿引起的变化。This includes refreshes resulting from calling the Refresh method, from the user's actions in the product, and from opening the workbook containing the query table.


表达式BeforeRefresh(取消)expression.BeforeRefresh (Cancel)

_表达式_一个代表查询表对象**** 的变量。expression A variable that represents a QueryTable object.


名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
CancelCancel 必需Required BooleanBoolean False 在事件发生时。False when the event occurs. 如果该事件过程将此参数设置为 True,则该过程结束之后不进行刷新。If the event procedure sets this argument to True, the refresh doesn't occur when the procedure is finished.

返回值Return value



本示例在刷新查询表之前运行。This example runs before the query table is refreshed.

Private Sub QueryTable_BeforeRefresh(Cancel As Boolean) 
 a = MsgBox("Refresh Now?", vbYesNoCancel) 
 If a = vbNo Then Cancel = True 
 MsgBox Cancel 
End Sub

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.