I'm running a macro on a word document.
After doing a Selection.Copy
and running on, while debugging, I want to be able to see what was actually copied, and if it was mistakenly replaced.
Is there a way to "watch" Windows' clipboard?
I found a way. At the beginning of my code:
Dim obj As New DataObject
obj.GetFromClipboard
I needed to reference Microsoft Forms 2.0 Object Library to have the "DataObject". At first I couldn't find it on the list - had to browse for FM20.dll.
The second line could be typed on need in immediate window, instead of writing it in the code. I found it easier this way.
Then, in the watch window, I put obj.GetText
as a watch expression and voilà!
clipbrd.exe
is the Windows clipboard viewer.