Use Clipboard Methods
The Use Clipboard methods are standard Visual Basic methods that allow you to use the Microsoft Windows clipboard as an object. They do not return a value. You can use the Microsoft Windows Clipboard to transfer text to and from other applications that support this clipboard.
Format
Clipboard.Clear
Clipboard.GetText()
Clipboard.SetText string
Clipboard.GetFormat()
The following table describes the arguments that you can use with these methods.
Argument | Description |
---|---|
string |
A string or string expression that contains the text to send to the clipboard. |
The following table describes the statements that you can use the clipboard.
The following table describes the arguments that you can use with these methods.
Statement | Description |
---|---|
Clear |
Clears the contents of the clipboard. |
GetText |
Returns a text string from the clipboard. |
SetText |
Puts a text string in the clipboard. |
GetFormat |
Returns one of the following values:
|
If code or if a cut or copy operation places data that is of the same format as the data that currently resides in the clipboard, then the current data on the clipboard is lost.
Example
The following example places the following text string on the clipboard:
Hello, world:
Sub Button_Click
Dim mytext as String
mytext = "Hello, world."
Clipboard.Settext mytext
End Sub