Function Clipboard_Get()
0: ' Original name : getClipboard
1: 'http://www.vbaexpress.com/forum/showthread.php?t=37045
2: 'Add Reference: 'Reference: Microsoft Forms xx Object
Dim MyData As DataObject
On Error Resume Next
Set MyData = New DataObject
MyData.GetFromClipboard
getClipboard = MyData.GetText
End Function
Sub Clipboard_Get_DEMO()
0: 'http://www.vbaexpress.com/forum/showthread.php?t=37045
Dim s As String, lineCount As Long
If Application.CutCopyMode = xlCopy Or Application.CutCopyMode = xlCut Then
MsgBox "Row Count: " & Selection.Rows.count
Exit Sub
End If
s = getClipboard
lineCount = UBound(Split(s, vbCrLf)) + 1
MsgBox s, vbInformation, "Line Count: " & lineCount
End Sub