Syntax

expression.RefreshOnChange

expression A variable that represents a Parameter object.

Remarks

You can set this property to True only if you use parameters of type xlRange and if the referenced parameter value is in a single cell. The refresh occurs when you change the value of the cell.

Example

This example changes the SQL statement for the first query table on Sheet1. The clause "(ContactTitle=?)" indicates that the query is a parameter query, and the value of the title is set to the value of cell D4. The query table will be automatically refreshed whenever the value of this cell changes.

Visual Basic for Applications
Set objQT = Worksheets("Sheet1").QueryTables(1) objQT.CommandText = "Select * From Customers Where (ContactTitle=?)" Set objParam1 = objQT.Parameters _ .Add("Contact Title", xlParamTypeVarChar) objParam1.RefreshOnChange = True objParam1.SetParam xlRange, Range("D4")
refresh refresh on change Refresh On Change Property refreshon RefreshOnChange RefreshOnChange Property

See also: