I have one sheet ("Sheet2") with imported data from TXT in my workbook. Data are refreshed every day from file ZLX02S_FG_ & "sufix". Name and path of the file are always known or calculated.
File name = ZLX02S_FG_20180821_095910.txt
Path name = C:\Users\lmisek\Desktop\WMS-L05-FG\
I have tried this code:
Sub Refresh_Macro()
With Worksheets("Sheet2").QueryTables(1)
.Connection = "TEXT;C:\Users\lmisek\Desktop\WMS-L05-FG\ZLX02S_FG_20180821_095910.txt"
.Refresh BackgroundQuery:=False
End With
End Sub
Data on the sheet2 are refreshed, but only if one will choose file in the dialog. I want to refresh them without dialog.
Any ideas?
TextFilePromptOnRefresh property is what you are looking for.
Please note, that it may also be necessary to explicitly set in code some of the import parameters, like delimiter etc.