PDA

View Full Version : Solved: Clipboard



daveyboyh
11-30-2005, 08:36 AM
I am running a macro in Excel that will systematically open up a worksheet, copy their contents to a "master" sheet and then close, before moving on to the next worksheet.

The problem occurs when the work sheet from which the data has been copied to the master sheet closes. I can ensure that the message box asking if I want to save changes doesn't appear (ActiveWindow.Close (False)), but cannot automatically say "No" to the message box asking if I want to save the information in the clipboard.

Hopefully someone can understand the above (!!!) and help me!

Cheers:banghead:

Marcster
11-30-2005, 08:57 AM
Hi daveyboyh,

To clear the contents of the Clipboard with VBA,
this is just one way:

Sub ClearTheContentsOfClipboard()
'Need a ref set to Microsoft Forms 2.0 Object Library
Dim objDataObject As New DataObject
objDataObject.SetText ""
objDataObject.PutInClipboard
Set objDataObject = Nothing
End Sub


HTH,

Marcster

mvidas
11-30-2005, 09:39 AM
What about just using Application.CutCopyMode = False ? That should do the same as well
Matt

daveyboyh
11-30-2005, 09:41 AM
I never tried the simplistic version, presuming it wouldn't work.

I was wrong!! Perfect, thanks
:beerchug:

mvidas
11-30-2005, 10:11 AM
Glad to help, and welcome to VBAX!

I'll mark this 'Solved' for you. You can do the same in the future by going to Thread Tools at the top, then Mark Thread Solved.

Let us know if you need anything else!
Matt