Erasing the clipboard

A

Arkansas Lady

I want to erase the clipboard when a form is closed. I have tried using the
docmd.runcommand(cmdClearAll) command in the unload and in the close events
and it does not work. I'm not sure if the ClearAll command will do what I
want. Any suggestions. Thanks
 
C

CompGeek78

I want to erase the clipboard when a form is closed.  I have tried using the
docmd.runcommand(cmdClearAll) command in the unload and in the close events
and it does not work.  I'm not sure if the ClearAll command will do what I
want.  Any suggestions.  Thanks
Put the below code into a module in your database.

'----- start of code -----
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


Function EmptyClipboard()
If apiOpenClipboard(0&) <> 0 Then
Call apiEmptyClipboard
Call apiCloseClipboard
End If
End Function
'----- end of code -----

Then anytime you want to empty your clipboard, just use
EmptyClipboard. This works for sure in 2003, I haven't tested it in
2007.

Keven Denen
 
A

Arkansas Lady

--
Arkansas Lady


CompGeek78 said:
Put the below code into a module in your database.

'----- start of code -----
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


Function EmptyClipboard()
If apiOpenClipboard(0&) <> 0 Then
Call apiEmptyClipboard
Call apiCloseClipboard
End If
End Function
'----- end of code -----

Then anytime you want to empty your clipboard, just use
EmptyClipboard. This works for sure in 2003, I haven't tested it in
2007.

Keven Denen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top