Here is a function that was working some time ago but now ... not so much. 
The msgbox is working. I do receive the informational message that does contain the string data, properly (as expected). However, when I attempt to immediately paste (either with the CTL-V shortcut or with the paste option under Edit menu item) nothing happens. The text does not get "pasted".
Any ideas why this would work (for a long time) and now not work? All theories welcome.
Thanks, much.
Sue
Sub CopyTextToClipboard(sInpText As String)
'Copy text to the clipboard (using DataObject)
'Enable Forms Library: Tools > References > Microsoft Forms 2.0 Object Library
Dim obj As New DataObject
Dim objShell As Object
'Make object's text equal to the input string
obj.SetText sInpText
'Place DataObject's text into the Clipboard
obj.PutInClipboard
If Len(sInpText) <= 900 Then
'Notify User
MsgBox "The following has been placed on the clipboard for your convenience: " & vbCrLf & vbCrLf & _
sInpText, vbInformation
Else
sInpText = "The following has been placed on the clipboard for your convenience: " & _
vbCrLf & vbCrLf & sInpText
Set objShell = CreateObject("Wscript.Shell")
objShell.popup sInpText
Set objShell = Nothing
End If
End Sub
Bookmarks