Using Custom Parameters with AutoText
The code of an auto-text item can be enriched with standard parameters that are replaced
at insertion time with specific values automatically determined by CodeSMART.
However, there may be times when the need to provide other variable values than
the ones already represented by the standard parameters appears.
For example, when the inserted code contains a variable piece of code
that appears repeatedly. Let's consider the following code piece:
MyRecordset.Seek "=", ValueToSeekFor
If Not MyRecordset.NoMatch Then
End If
Instead of typing 'MyRecordset' each time, you could define a custom parameter
(e.g. RsName) and include it in the auto-text item code using the
Custom Parameters popup:
To create a custom parameter:
-
Click Edit Custom Parameters in the Parameters menu of the AutoText Manager to
display the Edit Custom Parameters dialog box.
-
Click on the Add New button or click on the first empty
cell of the Name column in the Custom Parameters grid.
-
Type a meaningful name for the custom parameter. This is the name
that will be listed in the Enter Parameter Values dialog box.
-
You can provide a default value for the custom parameter in the
corresponding grid cell.
-
Optionally, you can type a short description for the current custom parameter.
This text will be displayed in the Enter Parameter Values dialog's descriptive
area (below the grid that lists the parameters and their values).
From now on, each time you will type the alias 'rssk' into a Visual Basic code
window a dialog box will be displayed allowing you to specify the
appropriate value for the RsName custom parameter.
Here it is how the Enter Parameter Values dialog box will appear
in our example:
Notes
-
The same custom parameter can be used in multiple auto-text items.
-
If a custom parameter name is modified then you will have to manually
change every instance of the parameter's previous name in all the
items where it was present.
-
Deleting a custom parameter does not actually remove it from any
item code where it was present.
See also
Back To Top
|