Guidance with creating a bespoke .txt
the following pseudo code should get you going.
Sub Doit()
Dim sStr as String
Dim LineofText As String
Dim rw as Long
rw = 0
Open "C:\CMDFILE\MyFile.cmd" For Output As #1
Print #1, "Echo Off"
print #1, "Dir *.* c:\newfile.txt"
'Close the file
Close #1
Shell "C:\cmdfile\myfild.cmd"
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
On Error Resume Next
Kill "C:\CMDFILE\MyFile.cmd"
On Error goto 0
End Sub
--
Regards,
Tom Ogilvy
"Krayten" wrote in message
om...
Hi All,
Hoping that someone might be able to give me a push in the right
direction here...please!
I need to have xlvba create a simple two line .cmd file, the contents of
which will be determined via several userforms that the user will have
had to fill in.
I have no problem getting the .cmd to then run in the background using
the Shell commands - it's just the creation of the file ( which is
essentially just a .txt anyway ) and the inputting of the two or so
lines of data.
I would ideally like to create the .cmd then fill in the two lines, then
delete the .cmd at the end, if this is possible.
I would be very grateful for any direction.
Rgds
======
Stuart
|