I have not personally encountered this specific copy / paste behavior before. However, I do have some code snippets that may help achieve the workflow you are looking for.
As a first step, I suggest inspecting the clipboard contents directly to verify if the extra quotation marks are present there initially.
If the quotation marks exist in the clipboard data already, then my provided code should be able to handle stripping them out before the paste.
However, if the clipboard does not contain the extra quotation marks after the copy, that indicates the quotation marks are being introduced later in the process by other system
.
Private Sub Button6_Click()
Application.ScreenUpdating = False
Dim xSheet As Worksheet
Set xSheet = ActiveSheet
If xSheet.Name <> "Definitions" And xSheet.Name <> "fx" And xSheet.Name <> "Needs" Then
xSheet.Range("B6").Copy
' Check the content of clipboard
Debug.Print GetClipboard()
End If
Application.ScreenUpdating = True
End Sub
Here is some sample code to modify the contents of the clipboard programmatically.
Private Sub SetClipboard(ByVal strInt As String)
Dim objCB As Object
Set objCB = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
With objCB
.settext strInt
.putinclipboard
End With
End Sub
Private Function GetClipboard() As String
Set objCB = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
With objCB
.GetFromClipboard
GetClipboard = .GetText
End With
End Function
Sub DEMO()
Dim vTemp
' Simulate your case, put "ABC" (with quotation mark) on clipboard
Call SetClipboard("""ABC""")
vTemp = GetClipboard()
If Len(vTemp) > 0 Then
SetClipboard (Mid(vTemp, 2, Len(vTemp) - 2))
End If
Debug.Print GetClipboard()
End Sub