Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Clear Clipboard in VB

In Windows Excel 2000, I am trying to clear the clipboard using commands in a macro, but have not found a solution. I have tried the following suggestions from other postings, but these have not worked. The ones that I have tried are

1. Application.CutCopyMode = False (Maybe works in the XP version

2. Public Sub ClearClipboard() (Compiler does not like the DataObject definition
Dim MyDataObj As New DataObjec
MyDataObj.SetText "
MyDataObj.PutInClipboar
End Su

3. Public Declare Function OpenClipboard Lib "user32" (
ByVal hwnd AsLong) As Lon
Public Declare Function CloseClipboard Lib "user32" () As Lon
Public Declare Function EmptyClipboard Lib "user32" () As Lon

Sub ClearClipboard(
OpenClipboard (0&
EmptyClipboar
CloseClipboar
End Su

Put declarations in a General module

4. Clipboard.clear (Compiler does not like this command.

5. Dim doFName As MSForms.DataObject (Compiler does not like the DataObject definition

Set doFName = New DataObjec

doFName.SetText "

doFName.PutInClipboard ' clears clipboar

Does anyone have a verifed solution for Excel 2000 running on a Windows 2000 machine

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Clear Clipboard in VB

Steve,

The problem with solution #2 is that you need a reference to the
MSForms type library. In VBA, go to the Tools menu, choose
References, and choose "Microsoft Forms 2.0 Object Library".

Solution #3 works in all version of Excel and Windows. Just call
the ClearClipboard function.

Solution #4 doesn't work in VBA because VBA doesn't have a
Clipboard object like VB6 does.

The problem in solution #5 is the same as in #2: you need a
reference to the MSForms type library.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Steve" wrote in message
...
In Windows Excel 2000, I am trying to clear the clipboard using

commands in a macro, but have not found a solution. I have tried
the following suggestions from other postings, but these have not
worked. The ones that I have tried a

1. Application.CutCopyMode = False (Maybe works in

the XP version)

2. Public Sub ClearClipboard() (Compiler

does not like the DataObject definition)
Dim MyDataObj As New DataObject
MyDataObj.SetText ""
MyDataObj.PutInClipboard
End Sub

3. Public Declare Function OpenClipboard Lib "user32" ( _
ByVal hwnd AsLong) 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

Put declarations in a General module.

4. Clipboard.clear (Compiler

does not like this command.)

5. Dim doFName As MSForms.DataObject (Compiler does not like

the DataObject definition)

Set doFName = New DataObject

doFName.SetText ""

doFName.PutInClipboard ' clears clipboard


Does anyone have a verifed solution for Excel 2000 running on a

Windows 2000 machine?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clear Clipboard in VB

Not very elegant, but why not just copy a single cell contents. Use
this successfully in the past

--
Message posted from http://www.ExcelForum.com

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 clear clipboard memory? Eric Excel Discussion (Misc queries) 2 April 6th 10 06:09 PM
Why does it clear my clipboard? Jessica P Excel Discussion (Misc queries) 5 March 19th 08 09:14 PM
Clear clipboard contents Cordobes Excel Discussion (Misc queries) 4 November 22nd 05 02:41 AM
Clear Clipboard John McGimpsey Excel Programming 0 February 1st 04 10:14 PM
Clear clipboard Deer Hunter Excel Programming 1 August 4th 03 01:47 PM


All times are GMT +1. The time now is 05:13 PM.

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

About Us

"It's about Microsoft Excel"