Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default Check for blank clipboard

In an Excel 2003 macro, how do I check for a blank (empty) clipboard?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Check for blank clipboard

If you want to test whether the user is in the process of a copy or
cut operation within Excel, you can use

Select Case Application.CutCopyMode
Case xlCopy
Debug.Print "Copy in progress"
Case xlCut
Debug.Print "Cut in progress"
Case Else
Debug.Print "No copy/cut in progress"
End Select


This returns that status of Excel's clipboard, returning true if there
is a copy or cut pending (the range has the marching ants border). You
can cancel the copy/cut mode with

Application.CutCopyMode = False


If you really need to see if *anything* (including non-Excel related
stuff) is in the clipboard, use


Public Declare Function CountClipboardFormats Lib "user32" () As Long

Sub AAA()
Dim N As Long
N = CountClipboardFormats()
If N = 0 Then
Debug.Print "nothing on clipboard"
Else
Debug.Print "something on clipboard"
End If
End Sub

If you want to totally clear the clipboard, use

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

Sub ClearClipboard()
OpenClipboard 0&
EmptyClipboard
CloseClipboard
End Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)





On Thu, 12 Feb 2009 08:36:18 -0800, Mr. Clean
wrote:

In an Excel 2003 macro, how do I check for a blank (empty) clipboard?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check for blank cells with formula Bob Flanagan[_2_] Excel Discussion (Misc queries) 3 January 7th 09 04:12 AM
Using Vlookup and IF statements to check for blank cells Koomba Excel Worksheet Functions 4 September 27th 08 03:54 PM
Clipboard empty but still get waring that clipboard is full Steve Excel Discussion (Misc queries) 0 June 17th 08 09:05 PM
check a row ignore blank cells print only those with text Rollo Tomasi Excel Discussion (Misc queries) 4 May 18th 07 08:32 AM
check for two blank cells before populating a 3rd. slinger Excel Worksheet Functions 6 October 25th 06 08:14 PM


All times are GMT +1. The time now is 12:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"