View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
John Austin[_6_] John Austin[_6_] is offline
external usenet poster
 
Posts: 18
Default How to lock the clipboard

This looks very promising - thanks, I will try it out!
--
John Austin


"okaizawa" wrote:

Hi,

Excel seems to be able to copy and paste in an instance without using
the clipboard. how about something like this?

Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
Declare Function CloseClipboard Lib "user32" () As Long
Declare Function EmptyClipboard Lib "user32" () As Long


If OpenClipboard(0) = 0 Then
MsgBox "cannot open clipboard."
ElseIf EmptyClipboard() = 0 Then
MsgBox "cannot clear clipboard."
Else

'code to copy and paste

CloseClipboard
End If

--
HTH,

okaizawa


John Austin wrote:
I have a VB app that creates an instance of Excel, and then intensively gets
Excel to copy and paste data between worksheets. The problem that I have is
that whilst this is going on (for about 5 minutes), if the user copies data
in another application, then that data is pasted into Excel instead of the
data that was intended.

How can Excel 'lock' the clipboard between the Copy and Paste commands so as
to ensure that this does not happen?

John Austin