zelarra821
Registered User.
- Local time
- Tomorrow, 00:27
- Joined
- Jan 14, 2019
- Messages
- 842
Hello. I wanted to know if it is possible to paste plain text into a rich text field.
I tried it: Yes.plain text into a rich text field
Private Sub cmdChange_Click()
'Where RT is the name of the Richtext field
Me.RT = Application.PlainText(Me.RT)
End Sub
Private Sub cmdClip_Click()
Me.RT = Application.PlainText(Clipboard)
End Sub
Function Clipboard(Optional StoreText As String) As String
'PURPOSE: Read/Write to Clipboard
'Source: ExcelHero.com (Daniel Ferry)
Dim x As Variant
'Store as variant for 64-bit VBA support
x = StoreText
'Create HTMLFile Object
With CreateObject("htmlfile")
With .parentWindow.clipboardData
Select Case True
Case Len(StoreText)
'Write to the clipboard
.setData "text", x
Case Else
'Read from the clipboard (no variable passed through)
Clipboard = .GetData("text")
End Select
End With
End With
End Function
Private Sub cmdConvert_Click()
Me.RT = Application.PlainText(Nz(RT, ""))
End Sub