hi gurus, what is the vba syntax for paste the clipboard content value?
hi gurus, what is the vba syntax for paste the clipboard content value?
Hi VINOTHBASKRAN,
The following code should help you:
Lewis![]()
Option Explicit 'In the debugger: 'Tools -> References -> Microsoft Forms 2.0 Object Library (Excel 2003 version) 'or you will get a "Compile error: user-defined type not defined" Sub PutSomethingInClipboard() Dim mydataobj As New MSForms.DataObject mydataobj.SetText 123 mydataobj.PutInClipboard End Sub Sub RetrieveClipboardData() Dim DataObj As New MSForms.DataObject Dim S As String DataObj.GetFromClipboard S = DataObj.GetText Debug.Print S 'print code in the debugger immediate window (CTRL - G) End Sub Sub ClearClipboardData() 'NOTE: 'DataObj.Clear' does not always work Dim DataObj As New MSForms.DataObject DataObj.SetText "" DataObj.PutInClipboard End Sub
Last edited by LJMetzger; 11-13-2014 at 09:03 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks