Saturday, 31 March 2018

VBA to paste text from clipboard | VBA program to paste text from clipboard

You can use below code to paste data from clipboard.


Sub PasteFromClipboard(b As Boolean)
    Dim clipboard As MSForms.DataObject
    Dim str1 As String

    Set clipboard = New MSForms.DataObject
   
    clipboard.GetFromClipboard
    str1 = clipboard.GetText
End Sub