SetText method (Microsoft Forms)

Copies a text string to the DataObject using a specified format.


object. SetText(StoreData [, format ] )

The SetText method syntax has these parts:

Part Description
object Required. A valid object.
StoreData Required. Defines the data to store on the DataObject.
format Optional. An integer or string specifying the format of StoreData. When retrieving data from the DataObject, the format identifies the piece of data to retrieve.


The settings for format are:

Value Description
1 Text format.
A string or integer value other than 1 A user-defined DataObject format.


The DataObject stores data according to its format. When the user supplies a string, the DataObject saves the text under the specified format.

If the DataObject contains data in the same format as new data, the new data replaces the existing data in the DataObject. If the new data is in a new format, the new data and the new format are both added to the DataObject, and the previously existing data is there as well.

If no format is specified, the SetText method assigns the Text format to the text string. If a new format is specified, the DataObject registers the new format with the system.

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.