Hi Guys,
I'm having problems with a macro to parse RTF data into clipboard, this i my code thus far:
Private Declare Function OpenClipboard Lib "USER32" (ByVal hWnd As Long) As Long
Private Declare Function RegisterClipboardFormat Lib "USER32" Alias _
"RegisterClipboardFormatA" (ByVal lpString As String) As Long
Private Declare Function EmptyClipboard Lib "USER32" () As Long
Private Declare Function CloseClipboard Lib "USER32" () As Long
Private Declare Function SetClipboardData Lib "USER32" ( _
ByVal wFormat As Long, ByVal hMem As Long) As Long
Private Declare Function GetClipboardData Lib "USER32" (ByVal wFormat As _
Long) As Long
Private Declare Function GlobalAlloc Lib "kernel32" (ByVal wflags As Long, _
ByVal dwbytes As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
ByVal destination As Long, source As Any, ByVal length As Long)
Private Declare Function EnumClipboardFormats Lib "USER32" _
(ByVal wFormat As Long) As Long
Private Enum enumClipboardFormat
[_First] = 1 '//This is required if u want to check range
CF_TEXT = 1
CF_BITMAP = 2
CF_METAFILEPICT = 3
CF_SYLK = 4
CF_DIF = 5
CF_TIFF = 6
CF_OEMTEXT = 7
CF_DIB = 8
CF_PALETTE = 9
CF_PENDATA = 10
CF_RIFF = 11
CF_WAVE = 12
CF_UNICODETEXT = 13
CF_ENHMETAFILE = 14
CF_HDROP = 15
CF_LOCALE = 16
CF_RTF = 17
CF_MAX = 18
[_Last] = 18 '//This is required if u want to check range
End Enum
Public Function PutInClipboard(s As String, _
Optional FormatID As Variant) As Boolean
End Function
Sub Button7_Click()
Dim sRTF As Long
Dim format As Long
format = RegisterClipboardFormat("Rich Text Format")
sRTF = "RTFTEXTHERE"
SetClipboardData (format, sRTF)
End Sub
Wondering where i went wrong. Yes, i know some of the declaration are not needed, however, i was putting everthing in for testing.
Thanks
Gary
Bookmarks