I just created a form with a text box on it; named the text box control "txtView".
Created a button named "cmdSubmit".
tried to add the code you posted.... would not compile. "ShellRun" is not a valid VBA command.
Changed the command to "Shell".
Code:
Private Sub cmdSubmit_Click()
Dim CMDLineCommand As String
CMDLineCommand = " echo " & Me.txtView & " > log.txt "
MsgBox CMDLineCommand
Shell ("cmd.exe /c " & CMDLineCommand)
' ShellRun ("cmd.exe /c " & CMDLineCommand)
End Sub
Entered "Help" into the text box.
Clicked the button.
A text file named "log.txt" was created.