Class Parameter (Excel VBA)

The class Parameter represents a single parameter used in a parameter query.

Member in collection


To use a Parameter class variable it first needs to be instantiated, for example

Dim prm as Parameter
Set prm = ActiveCell.QueryTable.Parameters(Index:=1)

The following procedures can be used to set variables of type Parameter: Parameters.Add and Parameters.Item.

For Each

Here is an example of processing the Parameter items in a collection.

Dim prm As Parameter
For Each prm In ActiveCell.QueryTable.Parameters
Next prm

SetParam - Defines a parameter for the specified query table.

Parameters.Add - Creates a new query parameter.

Parameters.Delete - Deletes the object.

Parameters.Item - Returns a single object from a collection.


DataType returns or sets an XlParameterDataType value that represents the data type of the specified query parameter.

Name returns or sets a String value representing the name of the object.

PromptString returns the phrase that prompts the user for a parameter value in a parameter query.

RefreshOnChange true if the specified query table is refreshed whenever you change the parameter value of a parameter query.

SourceRange returns a Range object that represents the cell that contains the value of the specified query parameter.

Type returns an XlParameterType value that represents the parameter type.

Value returns a Variant value that represents the parameter value.

Parameters.Count returns a Long value that represents the number of objects in the collection.

Range - Represents a cell, a row, a column, a selection of cells containing one or more contiguous blocks of cells, or a 3D range.