Clipboard macro seriously locks up (or whatever it does) myclipboard! [XL2003]


S

StargateFan

Hello, everyone!

I've found that a workbook of mine seriously wrecks the clipboard.
When I use the script once, everything seems fine. But if I run it
again or at least more than once, my clipboard is shot and nothing
restores it. I set up a script in a third party scripting language
after much research on the web yesterday and even shutting down
rdpclip.exe doesn'f fix things, The same script then launches the
clipboard viewer, clipbrd.exe, but the interesting thing that showed
is that the viewer flickers wildly and never opens properly. It's as
if the clipboard is wide open, maybe, and constantly looping, I don't
know. But ever after, I get all sorts of error commands like "can't
open clipboard" or "out of memory" and anything save to the clipboard
doesn't come out. The copy commands aren't greyed out anywhere, it's
just that nothing is retrieved from the clipboard.

I'm guessing that something needed closing somewhere so tried that
code from a source online for problems of this type but nothing short
of a reboot fixes this. In fact, this morning, even that didn't and I
had to shut down completely and let the box sit for a bit before
clipboard function was restored. One doesn't realize how much one
relies on the clipboard until it's not there, let me tell you!

Here is where the offending code lies:
******************
Sub Msg_CopyQuotefallToImage()
'
If Selection.Cells.Count = 1 Then
MsgBox ("You have only one cell selected; " & vbCrLf &
_
"pls increase the selection area" & vbCrLf & _
"before trying again.")

Exit Sub
End If

Application.CutCopyMode = False
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
' Selection.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
MyMsgBox = MsgBox("The cells have been sent to the clipboard as an
image." & vbCrLf & vbCrLf & _
"PASTE DIRECTLY INTO WORD for best results!" &
vbCrLf & vbCrLf & _
"(Stretch width for resulting Word graphic to
about 7 inches, max.) ", vbOKOnly 2+ vbInformation, "DONE ...")
End Sub
******************

I added in the "Application.CutCopyMode = False" as advised in the fix
but that didn't seem to help. I need to be able to press the copy
image button without fear any number of retries when I change the
source data.

Also, don't know if the copypicture command itself might be at fault.
I can't figure out if there's any difference between the "xlPicture"
format or the "xlBitmap" one and right now am afraid to try again
because when I use this script, I run into trouble <g>.

Anyone know how to get this to work without freaking out the clipboard
in Windows, by any chance? <g>

Thanks. :)
 
Ad

Advertisements

S

StargateFan

The part of the code above that is what gives trouble is either of
these two:

Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Selection.CopyPicture Appearance:=xlScreen, Format:=xlBitmap

If I run the macro once, no problem, but if I adjust the area and
press again, it seems to lock up the clipboard or somehow make it stop
working.

Is there code to put before this that empties the clipboard? What I
put didn't work (Application.CutCopyMode = False, found on the net).
Even with that line there the problem still occurs. Nothing short of
a reboot and sometimes complete shutdown, restores the clipboard
functionality.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top