Click to See Complete Forum and Search --> : How to check clipboard for data?


Jantsu
March 16th, 2001, 01:46 PM
I'm writing an Excel macro and I was wondering that how can I check the clipboard wheter it's empty or not?

If the clibboard contains data then the macro will continue and paste the data to the Excel sheet...

Can anybody help?

Iouri
March 16th, 2001, 02:17 PM
If you want to do it manually you can run clipbrd.exe.
If you want to include this piece into your app, try the following

strClip=Clipboard.GetText

that will bring data from clipboard to the string Clip. No you can check if this string is empty or compare it with whatever you want

Iouri Boutchkine
iouri@hotsheet.com

Jantsu
March 16th, 2001, 02:34 PM
I don't know much about VB objects. So can you tell me how do I define an object.

Your code gives the following error:

Run-time error '424:'
Object Required

Iouri
March 16th, 2001, 02:44 PM
I don't know what object gives you an error.
I just tested this code and everything was ok. Here is exactly the code that I was testing

Option Explicit

Private Sub Command1_Click()
Dim strClip As String

strClip = Clipboard.GetText
MsgBox strClip
End Sub


Iouri Boutchkine
iouri@hotsheet.com