+ Reply to Thread
Results 1 to 2 of 2

clipboard monitor

  1. #1
    Registered User
    Join Date
    01-25-2006
    Posts
    22

    clipboard monitor

    Hi,

    I have a app that cannot be linked to exel. I wrote some a little script when the data changes in the app it get auto copied to the clipboard.
    Is there a way in vb so I can monitor the clipboard so when it changes
    it auto paste the new content in cell a1. ( so i will have a realtime link )

    Thanks

    Johan

  2. #2
    Charlie
    Guest

    RE: clipboard monitor

    Cool idea. I never thought of trying that before. This worked. You will
    need to place two command buttons on Sheet1, change their captions to "Start
    Monitor" and "End Monitor" The Start Monitor will start an endless loop with
    a 1-second pause and a "DoEvents". The End Monitor will stop the loop.

    Note - placing the command buttons on the sheet is also necessary to force
    VB to add the "Microsoft Forms 2.0 Object Library" reference, which is
    required for the DataObject.

    Private Sub CommandButton1_Click()

    Dim EndTime As Single
    Dim PrevText As String
    Dim objDataObject As New DataObject

    Do
    objDataObject.GetFromClipboard
    If objDataObject.GetText(1) <> PrevText Then
    Range("A1") = objDataObject.GetText(1)
    PrevText = objDataObject.GetText(1)
    End If

    Set objDataObject = Nothing
    EndTime = Timer + 1 'one second
    Do While Timer < EndTime
    DoEvents
    Loop

    Loop

    End Sub

    Private Sub CommandButton2_Click()
    End
    End Sub


    "climax" wrote:

    >
    > Hi,
    >
    > I have a app that cannot be linked to exel. I wrote some a little
    > script when the data changes in the app it get auto copied to the
    > clipboard.
    > Is there a way in vb so I can monitor the clipboard so when it changes
    > it auto paste the new content in cell a1. ( so i will have a realtime
    > link )
    >
    > Thanks
    >
    > Johan
    >
    >
    > --
    > climax
    > ------------------------------------------------------------------------
    > climax's Profile: http://www.excelforum.com/member.php...o&userid=30816
    > View this thread: http://www.excelforum.com/showthread...hreadid=563781
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1