Coding is simplified for this discussion. c:\Temp is not the actual path.
VBA code executes the following batch file:
@Echo Off
"c:\Program Files\Winzip\WZUnzip.exe" -v c:\Temp\Test.zip > c:\Temp > ziplist.txt
Exit
Here's the VBA code:
HTML Code:
myBatFileName = "C:\Temp\ZListBat.bat"
Call Shell(myBatFileName, 1)
Workbooks.OpenText fileName:= _
"C:\Temp\ziplist.txt", Origin _
:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote _
, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:= _
False, Space:=False, Other:=True, OtherChar:="~", FieldInfo:=Array(1, 1) _
, TrailingMinusNumbers:=True
The Workbooks.OpenText statement fails to find the text file unless there is a delay. The question is, what is a smart, efficient way to delay VBA until the text file closes?
The purpose is to read the text file and extract the file date and file name to ensure that the expected file is found and it is current. It checks to see that the person responsible for providing the zipped file on a shared drive each month has done the job.
Jerry