vba to clipboard

The solution for “vba to clipboard” can be found here. The following code will assist you in solving the problem.

Function Clipboard(Optional StoreText As String) As String
‘PURPOSE: Read/Write to Clipboard
‘Source: ExcelHero.com (Daniel Ferry)

Dim x As Variant

‘Store as variant for 64-bit VBA support
x = StoreText

‘Create HTMLFile Object
With CreateObject(“htmlfile”)
With .parentWindow.clipboardData
Select Case True
Case Len(StoreText)
‘Write to the clipboard
.setData “text”, x
Case Else
‘Read from the clipboard (no variable passed through)
Clipboard = .GetData(“text”)
End Select
End With
End With

End Function

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts