Clipboard .GetText (method)

Syntax

Text$ = Clipboard.GetText([format])

Description

Returns the text contained in the Clipboard.

Comments

The format parameter, if specified, must be 1.

Example

This example checks to see whether there is any text on the Clipboard, if so, it searches the text for a string matching what the user entered.

Option Compare Text

Sub Main()

  r$ = InputBox("Enter a word to search for:","Scan Clipboard")

  If Clipboard.GetFormat(1) Then

    If Instr(Clipboard.GetText(1),r) = 0 Then
      MsgBox """" & r & """" & " was not found in the clipboard."
    Else
      MsgBox """" & r & """" & " is definitely in the clipboard."
    End If
  Else
    MsgBox "The Clipboard does not contain any text."
  End If
End Sub

See Also

Clipboard$ (statement); Clipboard$ (function); Clipboard.SetText (method).

More information

C