Erasing the clipboard

  • Thread starter Thread starter Arkansas Lady
  • Start date Start date
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
 
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
 
--
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
 
Back
Top