Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to determine in vba if clipboard is empty

555 views
Skip to first unread message

Tito Harris

unread,
Jul 16, 2002, 8:23:36 AM7/16/02
to
Hi everyone,

I was wondering how I can determine if the clipboard is empty or not in VBA?

I am using PowerPoint 2000 English

Thanks

tito harris


Justin D. Gilbert

unread,
Jul 16, 2002, 8:58:27 AM7/16/02
to
Tito,

Go to the google site below and type in "Clipboard Empty". I think you'll
find what you are looking for.

--
HTH,

Justin

---------
Try,

VB Manual (MSDN):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/htm
l/vbstartpage.asp

VB News Group's Archive:
http://groups.google.com/advanced_group_search?q=group:microsoft.public.vb.*
&hl=en&safe=off&num=50

Thanks to Miks, here is a couple more helpfull sources

Some VB Web Page Search Engines:
http://www.codehound.com/vb/
http://searchvb.techtarget.com/

"Tito Harris" <titoh...@swissonline.ch> wrote in message
news:3d34...@news.swissonline.ch...

Tito Harris

unread,
Jul 16, 2002, 9:11:07 AM7/16/02
to
Hi Justin,

Before I sent my message to the vba newsgroup I searched the internet for
about two hours...

I also checked all of your links but I still haven't found a code example
that can check to see if the clipboard is empty...I am trying to do this in
PowerPoint 2000 English VBA...I don't think it is possible in VBA but maybe
with some API calls...it could also be that I am just blind and cannot see
the answer but I'd love it if I could get some help on this...:-)

Regards,

tito


"Justin D. Gilbert" <U...@unknown.com> wrote in message
news:eNoAXgMLCHA.1480@tkmsftngp13...

Steve Rindsberg

unread,
Jul 16, 2002, 9:50:21 AM7/16/02
to
Strictly a kluge, Tito, but what about something like:

setting current selection to nothing
pasting
checking current selection to see what it is. if it's something, then it
must be the something that's on the clipboard.

--
Steve Rindsberg PPT MVP
PPT FAQ: http://www.pptfaq.com
PPTools: http://www.pptools.com


"Tito Harris" <titoh...@swissonline.ch> wrote in message

news:3d341b3f$1...@news.swissonline.ch...

Jonathan West

unread,
Jul 16, 2002, 9:54:06 AM7/16/02
to
Hi Tito,

Take a look at this article

Manipulating the clipboard using VBA
How to clear the clipboard or get the text on the clipboard into a string
variable
http://www.mvps.org/word/FAQs/MacrosVBA/ManipulateClipboard.htm

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
Word FAQs at http://www.multilinker.com/wordfaq
Please post any follow-up in the newsgroup. I do not reply to Word questions
by email

"Tito Harris" <titoh...@swissonline.ch> wrote in message
news:3d34...@news.swissonline.ch...

Tito Harris

unread,
Jul 16, 2002, 11:06:44 AM7/16/02
to
Hi Jonathan,

Thanks for your reply. I tried to run the code (before
your post) and I could not get it to run. When I try to
compile the code the message that the user defined
message that the user-defined type is not defined.
I just now tried it on Word 2002 same error...

Also, I am not sure if that solves my problem. Why isn't
there a function like Clipbardhasdata true/false...It
seemed so simple...:-)

Regards from Switzerland,

tito

>.
>

Chirag Dalal

unread,
Jul 16, 2002, 11:53:40 AM7/16/02
to
You can count the number of formats present on the clipboard. If its zero,
then the clipboard is empty. THe following code snippet does exactly this:

---
Public Declare Function CountClipboardFormats Lib "user32" () As Long

Function IsClipboardEmpty() As Boolean
IsClipboardEmpty = (CountClipboardFormats() = 0)
End Function
---

- Chirag

Volume Control - Set volume level for slides
http://officerone.tripod.com/volctrl/volctrl.html

"Tito Harris" <titoh...@swissonline.ch> wrote in message
news:3d34...@news.swissonline.ch...

Tito Harris

unread,
Jul 16, 2002, 12:21:45 PM7/16/02
to

Thank You...Chirag

Your code snippet did the trick...hooraayy...

Regards from Switzerland

tito

>.
>

Steve Rindsberg

unread,
Jul 16, 2002, 2:05:35 PM7/16/02
to
Neat, succinct and to the point. Nice FAQsir. But it seems the data object
only works with text, where the clipboard may contain a variety of other
goodies. D'you know if there's any way to deal with non-text data
similarly?

--
Steve Rindsberg PPT MVP
PPT FAQ: http://www.pptfaq.com
PPTools: http://www.pptools.com

"Jonathan West" <jw...@mvps.org> wrote in message
news:#nY$wANLCHA.2456@tkmsftngp09...

Steve Rindsberg

unread,
Jul 16, 2002, 2:06:19 PM7/16/02
to
A thing of beauty, sir. Thanks!

--
Steve Rindsberg PPT MVP
PPT FAQ: http://www.pptfaq.com
PPTools: http://www.pptools.com

"Chirag Dalal" <dalal....@iname.com> wrote in message
news:e829FCOLCHA.2656@tkmsftngp11...

Jonathan West

unread,
Jul 16, 2002, 3:06:45 PM7/16/02
to

"Steve Rindsberg" <ab...@localhost.com> wrote in message
news:eQBRiMPLCHA.1744@tkmsftngp13...

> Neat, succinct and to the point. Nice FAQsir. But it seems the data
object
> only works with text, where the clipboard may contain a variety of other
> goodies. D'you know if there's any way to deal with non-text data
> similarly?
>

Karl Peterson has an topic on this on his site www.mvps.org/vb/

Follow the Samples link and download the ClipEx.zip file. In it is a set of
class modules which provide quite a range of features for controlling the
clipboard.

Steve Rindsberg

unread,
Jul 16, 2002, 5:03:31 PM7/16/02
to
Loverly!
Thanks, Jonathan.

--
Steve Rindsberg PPT MVP
PPT FAQ: http://www.pptfaq.com
PPTools: http://www.pptools.com
"Jonathan West" <jw...@mvps.org> wrote in message

news:OurgxwPLCHA.1968@tkmsftngp11...

Jon Peltier

unread,
Jul 16, 2002, 7:33:04 PM7/16/02
to
Tito -

From simple minds come simple solutions. Does this work? It seemed to work
from the debug window:

?application.commandbars(1).controls("&Edit").controls("&Paste").enabled

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______

In article <3d34...@news.swissonline.ch>, Tito Harris said...

Steve Rindsberg

unread,
Jul 16, 2002, 10:55:00 PM7/16/02
to
> From simple minds come simple solutions. Does this work? It seemed to
work
> from the debug window:
>
> ?application.commandbars(1).controls("&Edit").controls("&Paste").enabled
>

That's so ugly you just gotta love it. <g>
I had to use something like it to figure out some stuff about image
transparency, so I'm not laughing THAT loud.


Tito Harris

unread,
Jul 17, 2002, 3:59:02 AM7/17/02
to
Hi Jon,

Wow, that also works...and using the built in commandbars...why didn't I
think of that...aah I guess I am not such a simple mind as you are...:wish I
were though...;-)

Thanks to you and all the other helping hands in this forum...

Regards from Switzerland...

tito

-------------------------------

"Jon Peltier" <jonpe...@yahoo.com> wrote in message
news:eZPwiESLCHA.2312@tkmsftngp13...

0 new messages