ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determine clipboard data type? (https://www.excelbanter.com/excel-programming/454445-determine-clipboard-data-type.html)

RG III

Determine clipboard data type?
 
I'm using the following code to get the clipboard contents:

obj.GetFromClipboard
txt = obj.GetText(1)

But how do I determine if the clipboard contains data other than plain text? Like what if it contains a screen snapshot in bitmap format or something else?

-Robert

Peter T[_8_]

Determine clipboard data type?
 

"RG III" wrote in message
I'm using the following code to get the clipboard contents:

obj.GetFromClipboard
txt = obj.GetText(1)

But how do I determine if the clipboard contains data other than plain
text? Like what if it contains a screen snapshot in bitmap format or
something else?


DataObject methods only handle text, if available. No doubt the original
intention last century was eventually for it to return other formats, but
that never happened.

Simplest is to use the Excel object model's 'ClipboardFormats' which returns
an array of available formats, see ClipboardFormats in help. You could also
use the 'IsClipboardFormatAvailable' API to see if a specified format is
available (examples on line), be aware also need to open and close the
clipboard with OpenClipboard and CloseClipboard.

Peter T




All times are GMT +1. The time now is 10:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com