CodeItBetter Programming Another VB Programming Blog

How to check whether the format of text in Clipboard is RTF format.

Posted on October 31, 2011
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'System & API - How to check whether the format of text in Clipboard is RTF format.
If Clipboard.GetFormat(vbCFRTF) Then
    ' The Clipboard contains data in RTF format.
End If
 
'The value of format can be 1-vbCFText (plain text), 2-vbCFBitmap (bitmap), 
'3-vbCFMetafile (metafile), 8-vbCFDIB (Device Independent Bitmap), 9-vbCFPalette
'(color palette), &HBF01-vbCFRTF (text in RTF format), or &HBF00-vbCFLink (DDE 
'conversation information). This is the correct sequence for pasting text into 
'a RichTextBox control:

If Clipboard.GetFormat(vbCFRTF) Then
    RichTextBox1.SelRTF = Clipboard.GetText(vbCFRTF)
ElseIf Clipboard.GetFormat(vbCFText) Then
    RichTextBox1.SelText = Clipboard.GetText()
End If
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.