JohnTravolski
New Member
- Joined
- Nov 25, 2015
- Messages
- 45
- Office Version
- 2019
- Platform
- Windows
I have a macro to copy the selected cells as a comma delimited string to the clipboard:
It used to work fine. However, within the past couple of weeks, it simply stopped working. Nothing is copied to the clipboard anymore when I run it with cells selected. I have no idea what changed. Does anybody know why this might be? Is there something in Excel I should check is enabled? Any advice as to how to potentially fix this?
I have checked and MSForms is enabled:
VBA Code:
Sub CopySelectedAsCommaDelimittedString()
If Not Selection Is Nothing Then
Dim rtn As String: rtn = vbNullString
Dim r As Range
For Each r In Selection.Rows
Dim a: a = Application.Transpose(Application.Transpose(r))
rtn = rtn & Strings.Join(a, ",")
Next
If rtn <> vbNullString Then
Dim clip As MSForms.DataObject: Set clip = New MSForms.DataObject
clip.SetText rtn
clip.PutInClipboard
End If
End If
End Sub
It used to work fine. However, within the past couple of weeks, it simply stopped working. Nothing is copied to the clipboard anymore when I run it with cells selected. I have no idea what changed. Does anybody know why this might be? Is there something in Excel I should check is enabled? Any advice as to how to potentially fix this?
I have checked and MSForms is enabled: