Part | Description | |
object | Required. A valid object. | |
format | Required. An integer or string specifying a specific format that might exist in the DataObject. If the specified format exists in the DataObject, GetFormat returns True. |
Value | Description | |
1 | Text format. | |
A string or any integer other than 1 | A user-defined DataObject format passed to the DataObject from SetText. |
Dim MyDataObject As DataObject
Private Sub CommandButton1_Click()
'Put standard format on Clipboard
If TextBox1.TextLength > 0 Then
Set MyDataObject = New DataObject
MyDataObject.SetText TextBox1.Text
Label1.Caption = "Put on D.O."
CommandButton2.Enabled = True
CommandButton4.Enabled = False
End If
End Sub
Private Sub CommandButton2_Click()
'Get standard format from Clipboard
If MyDataObject.GetFormat(1) = True Then
Label1.Caption = "Std format - " & MyDataObject.GetText(1)
End If
End Sub
Private Sub CommandButton3_Click()
'Put custom format on Clipboard
If TextBox1.TextLength > 0 Then
Set MyDataObject = New DataObject
MyDataObject.SetText TextBox1.Text, 233
Label1.Caption = "Custom on D.O."
CommandButton4.Enabled = True
CommandButton2.Enabled = False
End If
End Sub
Private Sub CommandButton4_Click()
'Get custom format from Clipboard
If MyDataObject.GetFormat(233) = True Then
Label1.Caption = "Cust format - " & MyDataObject.GetText(233)
End If
End Sub
Private Sub UserForm_Initialize()
CommandButton2.Enabled = False
CommandButton4.Enabled = False
End Sub