Clipboard.GetFormat (method)

Syntax WhichFormat = Clipboard.GetFormat (format)
Description Returns TRUE if data of the specified format is available in the Clipboard; returns FALSE otherwise.
Comments This method is used to determine whether the data in the Clipboard is of a particular format. The format parameter is an Integer representing the format to be queried:
Format Description
1 Text
2 Bitmap
3 Metafile
8 Device-independent bitmap (DIB)
9 Color palette
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$ (function); Clipboard$ (statement).