Applecore Pages on Microsoft Access

Clearing the Clipboard using API calls

If you want to clear data from the clipboard, then you can use three API calls in sequence, to open, clear, and then close the clipboard:

Private Declare Function apiOpenClipboard Lib "user32" Alias "OpenClipboard" _
    (ByVal hwnd As Long) As Long
Private Declare Function apiEmptyClipboard Lib "user32" Alias "EmptyClipboard" _
    () As Long
Private Declare Function apiCloseClipboard Lib "user32" Alias "CloseClipboard" _
    () As Long
 
Public Sub sClearClipboard()
'   Procedure to clear the contents of the Windows clipboard
    On Error GoTo E_Handle
    Dim lngReturn As Long
    lngReturn = apiOpenClipboard(Application.hWndAccessApp)
    lngReturn = apiEmptyClipboard
    lngReturn = apiCloseClipboard
sExit:
    On Error Resume Next
    Exit Sub
E_Handle:
    MsgBox Err.Description & vbCrLf & "sClearClipboard", vbOKOnly + vbCritical, "Error: " & Err.Number
    Resume sExit
End Sub

Top

 


HOME | NEW | TABLES | QUERIES | FORMS | REPORTS | GENERAL | API | DOWNLOADS | TUTORIAL | RESOURCES
E-MAIL
Copyright & Disclaimer

 

Last modified at 06/06/2006 14:53:14