Dear all,
I have the following code:
While test2 works just fine (clears the clipboard), I can't get test1 to work. It (msgbox) always returns the value of 0. Could you please tell me what I would have to do to fix it. In essence I would expect it to retrieve / display the text that I have copied last.
Thank you for any help!
I have the following code:
Code:
[COLOR=#000000][FONT=verdana]Public Declare Function GetClipboardData Lib "user32" (CF_UNICODETEXT) As Long[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]Public Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]Public Declare Function EmptyClipboard Lib "user32" () As Long[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]Public Declare Function CloseClipboard Lib "user32" () As Long[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana][/FONT][/COLOR]
[FONT=verdana][COLOR=#000000]Sub test1()[/COLOR][/FONT]
[FONT=verdana][/FONT]
[FONT=verdana][COLOR=#000000]Dim wat As String[/COLOR][/FONT][FONT=verdana][/FONT]
[FONT=verdana][COLOR=#000000]OpenClipboard (0&)[/COLOR][/FONT]
[FONT=verdana][COLOR=#000000]wat = GetClipboardData(wFormat)[/COLOR][/FONT]
[FONT=verdana][COLOR=#000000]CloseClipboard[/COLOR][/FONT]
[FONT=verdana][/FONT]
[FONT=verdana][COLOR=#000000] [FONT=verdana][COLOR=#000000]MsgBox wat[/COLOR][/FONT] [/COLOR][/FONT]
[FONT=verdana][/FONT]
[FONT=verdana][COLOR=#000000]End Sub[/COLOR][/FONT]
[FONT=verdana][COLOR=#000000]Sub test2()[/COLOR][/FONT]
[FONT=verdana][COLOR=#000000]OpenClipboard (0&)[/COLOR][/FONT]
[FONT=verdana][COLOR=#000000]EmptyClipboard[/COLOR][/FONT]
[FONT=verdana][COLOR=#000000]CloseClipboard[/COLOR][/FONT][FONT=verdana][/FONT]
[FONT=verdana][COLOR=#000000]End Sub[/COLOR][/FONT]
Thank you for any help!
Last edited: