Option Compare Database
Option Explicit
Declare Function OpenClipboard Lib "User32" (ByVal hWnd As Long) As Long
Declare Function CloseClipboard Lib "User32" () As Long
Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags&, ByVal dwBytes As Long) As Long
Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem As Long) As Long
Declare Function lstrcpy Lib "kernel32" (ByVal lpString1 As Any, ByVal lpString2 As Any) As Long
Declare Function EmptyClipboard Lib "User32" () As Long
Declare Function SetClipboardData Lib "User32" (ByVal wFormat As Long, _
ByVal hMem As Long) As Long
Function ClipBoard_SetData(str2Copy As String)
Dim hGlobalMemory As Long, lpGlobalMemory As Long
Dim hClipMemory As Long, X As Long
hGlobalMemory = GlobalAlloc(&H42, Len(str2Copy) + 1)
lpGlobalMemory = GlobalLock(hGlobalMemory)
lpGlobalMemory = lstrcpy(lpGlobalMemory, str2Copy)
GlobalUnlock hGlobalMemory
OpenClipboard 0&
X = EmptyClipboard()
hClipMemory = SetClipboardData(1, hGlobalMemory)
CloseClipboard
End Function
|