An easy one !!! How to get the clipboard Size . Thanks

J

JOCA

Folks,

Here is an easy one. How can I measure the size (in KB or any memory
measurement unit) of the clipboard content (regardless of whether it is
text, an image, drawing object, data, etc.)? I would need either a line of
code or very clear instructions on how to do this. I am a newbie! Thanks in
advance to those of you who contribute to answer this question. THANKS.

JOCA
 
M

martinique

Unfortunately VBA (unlike VB) doesn't give you access to the clipboard
object at all. But in any case, I'm not sure that there would be a
meaningful answer anyway. The clipboard doesn't necessarily 'hold' whatever
it is that gets inserted when you paste: a) it might hold only a link to
some other object (when you embed an OLE object); b) the action of pasting
might be a collection of methods applied to the source object (eg all those
option on the PasteSpecial dialog), rather than distinct objects 'held' in
the clipboard; and c) the amount of memory used by the target application
when it receives the object might have very little to do with the size of
the object as referred to by the clipboard (eg when you paste a graphic into
Word it gets converted to an internal graphic format).

What are you actually trying to do?
 
J

JOCA

Dear Martinique, thanks for your help.

I receive a document (on a frequent basis) containing hundreds of small
pictures of which I want to preserve some and delete others. All this
pictures are really only two pictures (of check-marks and Xs), repeated in a
seemly random fashion, like when somebody fills a survey. I want to write a
routine that gets rid of the Xs and leaves the check-marks. I though by
copying (as in Edit/copy) the pictures one by one, effectively putting them
into the clipboard and measuring the size of the clipboard, I could tell
which one it was (check-mark or X) and delete or preserve it. Any Ideas?
 
M

martinique

Cute idea, but for reasons given, that's not going to work. If the pictures
are the same size and format, they'll use the same memory anyway; if they're
not the same size, then use the physical dimensions to tell them apart
(compare the .Height, .Width properties).
 

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