Hello,
I need to transfer two commands to command prompt. The first one is always the same and it calls a command line of another application (BEAM).
The second command is for the BEAM command line. It is taken from an Excel cell.
The code I managed to write is transfering only the first command, probably because after execution of the first command command prompt is getting BEAM command line.
I don't know what to do...
Public Clipboard As New MSForms.DataObject
Sub Mymacro()
Dim DataObj As New MSForms.DataObject
Dim strContents As String
Dim strCmd As String
Dim RetVal, A, fs
Range("A1").Copy
DataObj.GetFromClipboard
strContents = DataObj.GetText
strCmd = "cmd.exe /S /K C:\temp\beam-cli.bat"
Set fs = CreateObject("Scripting.FileSystemObject")
Set A = fs.CreateTextFile("C:\temp\vb.bat", True)
A.writeline strCmd
A.writeline strContents
A.Close
RetVal = Shell("C:\temp\vb.bat", 1)
End Sub
Bookmarks