I have code that writes a batch file and then shells the file in:
Everything works fine as long as I EXCLUDE the line where I delete the text file I just created.
Apparently, the executing code isn't waiting for the batch file to finish its job before it proceeds to the next line of code, and it deletes the batch file before it executes??
Is there a way to have the VB code wait (??) for the batch file to finish executing before it proceeds on the its own next line??
Obviously, I could just leave the file I created there, but I guess I'm kind of complusive about cleaning up after myself.
Thanking you in advance, Mike K
Code:
sub blahblah
dim fso as new filesystemobject, ts as textstream
set ts=fso.createtextfile("c:\temp\myfile.bat")
ts.writeline "net use m: \\myserver\myshare"
ts.close
shell("c:\temp\myfile.bat",vbhide)
fso.deletefile "c:\temp\myfile.bat"
end sub
Apparently, the executing code isn't waiting for the batch file to finish its job before it proceeds to the next line of code, and it deletes the batch file before it executes??
Is there a way to have the VB code wait (??) for the batch file to finish executing before it proceeds on the its own next line??
Obviously, I could just leave the file I created there, but I guess I'm kind of complusive about cleaning up after myself.
Thanking you in advance, Mike K