Senin, 28 November 2011

Re: [ExcelVBA] Re: Empty Clipboard from Data Copied in From Word to Excel

 

Steve-

Have you tried Windows API calls?  You should be able to use OpenClipboard,
EmptyClipboard, CloseClipboard and GetActiveWindow to take care of what you're
trying to do.

Each will have to be called out in your code declarations at the top:

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

then just add the following to the body of your code (or add a routine to do
clipboard dumps if you use it a lot):

Dim hwin As Long
hwin = GetActiveWindow()  '<<-- this gets the handle of whatever window is
active
OpenClipboard (hwin) '<<-- Opens up the clipboard for access
EmptyClipboard '<<-- Dumps the clipboard contents
CloseClipboard '<<-- closes it back up.
 
http://www.ex-designz.net/api.asp has a great rundown on available API calls for
use.

Mac

________________________________
From: sspatriots <sspatriots@yahoo.com>
To: ExcelVBA@yahoogroups.com
Sent: Mon, November 28, 2011 1:11:02 PM
Subject: [ExcelVBA] Re: Empty Clipboard from Data Copied in From Word to Excel

 

Can anybody help with this? It would seem that it could be automated with VBA to
show the office clipboard and the select the 'Clear All' button, but I've come
up with nothing. It won't let me record those steps so I am at a loss on this
one.

--- In ExcelVBA@yahoogroups.com, "sspatriots" <sspatriots@...> wrote:
>
> I've found numerous post with code that is supposed to empty the clipboard
>contents from the following:
>
> 1. Clear the Office Clip Board.
> 2. Clear the Windows Clip Board
> 3. Clear the last Cut/Copy/Paste cell tag.
>
> Everyone I have tried will not work in Excel 2010 or it may be just how I'm
>trying to make it work. Either way, my clipboard never gets cleared unless I
>close everything and get back in. Any ideas on what works best and how to make
>it work?
>
> Thanks,
>
> Steve
>

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar