Hey everyone. I have code to trigger 6 different batch files, which then outputs a txt file, which in turn i use power query to bring the txt file list into excel. I thought it was working fine until one day I noticed the date stamp on the txt file had not changed in a week, despite running the batch file. I ran the batch file by double clicking it a sure enough the txt file updated. I was then able to just use the "refresh all" option in excel to get the file list updates (this batch file simply goes into each folder and returns whatever files have a certain extension). My question is, what is going on here? The batch file comes on my screen and I see it doing its thing, then the next, and then the next but none of the files update. Anyone encounter this odd behavior before? Summarized code below:
Code:
Dim wsh As Object
Set wsh = VBA.CreateObject("WScript.Shell")
Dim waitOnReturn As Boolean: waitOnReturn = True
Dim windowStyle As Integer: windowStyle = 1
Dim MyPath As String
Dim MyShellCMD As String
MyShellCMD = """" & MyPath & "\" & "FileList.bat" & """"
wsh.Run MyShellCMD , windowStyle, waitOnReturn
ThisWorkbook.Connections("Query - FirstFolder").Refresh