ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   clipboard monitor (https://www.excelbanter.com/excel-programming/367987-clipboard-monitor.html)

climax[_4_]

clipboard monitor
 

Hi,

I have a app that cannot be linked to exel. I wrote some a littl
script when the data changes in the app it get auto copied to th
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 realtim
link )

Thanks

Joha

--
clima
-----------------------------------------------------------------------
climax's Profile: http://www.excelforum.com/member.php...fo&userid=3081
View this thread: http://www.excelforum.com/showthread.php?threadid=56378


Charlie

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




All times are GMT +1. The time now is 06:01 AM.

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