Clipboard return

V

Vsn

Hi all,

Could someone help me with the method to recover the last data which was
copied to the clipboard.

Lets say I copied string '876GG' as last to the clipboard from excel, word
or other Office application, how can i get it to a VBA string. I imagine
somthing like stgData = Clipboard.LastInput..........

Thx for any help.
Ludovic
 
C

Chay Harley

You need to add a reference to "Microsoft Forms 2.0" to get access to the
"DataObject" object that does all the heavy lifting for you.

ie.

Dim clipbrd as DataObject
dim stgData as string

set clipbrd = new DataObject
clipbrd.GetFromClipboard
stgData = clipbrd.GetText

HTH,
Chay Harley
 
V

Vsn

Thx for the help. Ludovic



Chay Harley said:
You need to add a reference to "Microsoft Forms 2.0" to get access to the
"DataObject" object that does all the heavy lifting for you.

ie.

Dim clipbrd as DataObject
dim stgData as string

set clipbrd = new DataObject
clipbrd.GetFromClipboard
stgData = clipbrd.GetText

HTH,
Chay Harley
 
Top