|
-
Aug 9th, 2005, 07:22 AM
#15
Thread Starter
New Member
Re: Pass a string to a DOS batch file
Thanks,
That code worked great. I got some help from the group alt.msdos.batch.nt as to how to construct the batch file:
@ECHO OFF
pushd "f:\discharge request screener"
main.exe
popd
Anyway for anyone else wishing to open a program that behaves similarly to the ones I had, here is the code in the command button that creates the batch file and then calls it (the batch file creation code comes from help from a VBForums thread):
Private Sub cmbRREL_Click()
Dim FFile As Integer
Dim strpathmain As String
Dim strshortpath As String
Dim line1 As String
Dim line2 As String
Dim line3 As String
Dim line4 As String
Dim RetVal
strshortpath = ActiveWorkbook.Path
strpathmain = ActiveWorkbook.Path & "\treat.bat"
line1 = "@ECHO OFF"
line2 = "pushd " & strshortpath
line3 = "main.exe"
line4 = "popd"
FFile = FreeFile
Open strpathmain For Output As #FFile
Print #FFile, line1
Print #FFile, line2
Print #FFile, line3
Print #FFile, line4
Print #FFile, line5
Print #FFile, line6
Close #FFile
'shell out to the batch file
RetVal = Shell(Environ("comspec") & " /c " & Chr(34) & strpathmain & Chr(34), 1)
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|