AW: copy&paste deaktivieren
12.03.2008 11:21:12
volti
Hallo,
noch mal ein Update, mit dem nun außerhalb von Excel normal kopiert und eingefügt werden kann.
Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function SetTimer Lib "user32" (ByVal hWnd As _
Long, ByVal nIDEvent As Long, ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" (ByVal hWnd As _
Long, ByVal nIDEvent As Long) As Long
Declare Function EmptyClipboard Lib "USER32.DLL" () As Long
Declare Function OpenClipboard Lib "USER32.DLL" (ByVal hWnd As Long) As Long
Declare Function CloseClipboard Lib "USER32.DLL" () As Long
Public hTimer As Long
Sub NoCopyNoPaste()
Dim hfWnd As Long
hfWnd = GetForegroundWindow()
If hTimer = 0 Then
hTimer = SetTimer(0, 0, 100, AddressOf NoCopyNoPaste)
hWndTimer = FindWindow("XLMAIN", vbNullString)
End If
If hfWnd = hWndTimer Then
T = OpenClipboard(0)
EmptyClipboard
CloseClipboard
End If
End Sub
Sub PasteAgain()
KillTimer 0, hTimer
hTimer = 0
End Sub
viele Grüße
KH