CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2000
    Posts
    24

    How to check clipboard for data?

    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?


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: How to check clipboard for data?

    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
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Nov 2000
    Posts
    24

    Re: How to check clipboard for data?

    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



  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: How to check clipboard for data?

    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
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured