I am trying to extract a few strings into Windows clipboard, which is working fine; but attempting to put a carriage return and line feed between each string is causing problems, I understand it is related to this thread: Escape angle brackets in a Windows command prompt
But I cannot get my code to work with the provided info.
This is my code without any vbCRLF;
Dim objShell
Set objShell = CreateObject("WScript.shell")
objShell.Run "cmd /C echo " & Control_Address1.text & Control_Address2.text & Control_Address3.text & Control_Address4.text & " | CLIP", 2
Which results in the contents on the strings Address1-4 being output one after each other but I want them in this format.
Address1
Address2
Address3
Address4
I tried:
objShell.Run "cmd /C echo " & Control_Address1.text & vbCRLF & Control_Address2.text & vbCRLF & Control_Address3.text & vbCRLF & Control_Address4.text & " | CLIP", 2
Which resulted in 'vbCTRL' being put in the clipboard and I learned about escape characters as a result. I then attempted the following code based upon the above thread.
objShell.Run "cmd /C echo " & Control_Address1.text ^& vbCRLF ^& Control_Address2.text ^& vbCRLF ^& Control_Address3.text & vbCRLF & Control_Address4.text & " | CLIP", 2
But this results in syntax errors, I'm heading in the right direction I think but appear to be stuck, any help you could offer a newbie would be greatly appreciated!