ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determine if clipboard is empty (https://www.excelbanter.com/excel-programming/401852-determine-if-clipboard-empty.html)

XP

Determine if clipboard is empty
 
Using Office 2003 and Windows XP;

Is it possible using VBA to determine if there are any contents in the
clipboard?

If so, could someone please post a generic example of how to do this?

Thanks much in advance.

ilia

Determine if clipboard is empty
 
For text data, try this:

Public Declare Function OpenClipboard Lib "user32" (ByVal hwnd As
Long) As Long
Public Declare Function CloseClipboard Lib "user32" () As Long
Public Declare Function GetClipboardData Lib "user32" (ByVal uFormat
As Long) As Long

Public Function isClipboardEmpty() As Boolean
OpenClipboard (0&)
isClipboardEmpty = (GetClipboardData(1) = 0)
CloseClipboard
End Function



On Nov 28, 1:28 pm, XP wrote:
Using Office 2003 and Windows XP;

Is it possible using VBA to determine if there are any contents in the
clipboard?

If so, could someone please post a generic example of how to do this?

Thanks much in advance.



Dana DeLouis

Determine if clipboard is empty
 
Just another option to test if the Clipboard is only holding an address
reference

Function LinkingModeQ() As Boolean
With Application
LinkingModeQ = .CutCopyMode = xlCopy Or .CutCopyMode = xlCut
End With
End Function

Sub Demo()
Range("A1").Copy
MsgBox LinkingModeQ

'// Windows: Linking mode compromised, therefore turned off
Application.CutCopyMode = False
MsgBox LinkingModeQ
End Sub

--
HTH
Dana DeLouis


"XP" wrote in message
...
Using Office 2003 and Windows XP;

Is it possible using VBA to determine if there are any contents in the
clipboard?

If so, could someone please post a generic example of how to do this?

Thanks much in advance.




All times are GMT +1. The time now is 11:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com