I using VBA / Excel (MICROSOFT OFFICE PROFESSIONAL PLUS 2016) / W10 Pro.
I have been using some code (my own) for a while to copy and paste some MT4 code (for Metatrader 4 Forex platform - C++ like code) from a textbox and into my MT4 environment.
The code I require is correct and it pastes correctly in the EXCEL environment but only generates ?? when pasted to MT4. If I copy directly the contents of textbox and paste directly then every " (double quote) is converted to "" (i.e. 2 x double quotes) - a solution but poor. I seem to recollect even this worked ages ago before I copied to the clipboard ready for pasting.
I have added lines for testing but which sort of seem to work but still produces ?? when posted to MT4
I have been using some code (my own) for a while to copy and paste some MT4 code (for Metatrader 4 Forex platform - C++ like code) from a textbox and into my MT4 environment.
The code I require is correct and it pastes correctly in the EXCEL environment but only generates ?? when pasted to MT4. If I copy directly the contents of textbox and paste directly then every " (double quote) is converted to "" (i.e. 2 x double quotes) - a solution but poor. I seem to recollect even this worked ages ago before I copied to the clipboard ready for pasting.
I have added lines for testing but which sort of seem to work but still produces ?? when posted to MT4
Code:
Private Sub MultiPage1_Change()Dim clipboard As MSForms.DataObject
Dim str1 As String, str2 As String, str3 As String, str4 As String
Sheets("Test").Cells(1, 1) = ""
Sheets("Test").Cells(1, 2) = ""
Set clipboard = New MSForms.DataObject
str1 = TextBox6.Value
clipboard.SetText TextBox6.Value
str2 = TextBox6.Value
clipboard.PutInClipboard
str3 = "Contents" + vbCrLf + "have been" + vbCrLf + "copied to" + vbCrLf + "Clipboard"
TextBox9.Value = str3
Sheets("Test").Cells(1, 1) = str3
Sheets("Test").Cells(2, 1) = str2
testclipboard (str2)
'Unload Me
End Sub
Sub testclipboard(mytext As String)
Dim str1 As String
Set clipboard = New MSForms.DataObject
Set MyData = New DataObject
str1 = mytext
MyData.SetText mytext
MyData.PutInClipboard
'Sheets("Test").Cells(6, 1).Paste
'TextBox2.Paste
End Sub