Hi,
I don't know why this is not working. Any ideas?
If I hardcode the file address then it works fine, but when I use TxtFile instead of the file path then it gives an error that it can't find the file and highlights:
AMAS
I don't know why this is not working. Any ideas?
Code:
Dim TxtFile As String
' Open dialog box
TxtFile = Application.GetOpenFilename("XML Files,*.xml")
If TxtFile = "False" Then Exit Function
' Import data from Text file
With ThisWorkbook.ActiveSheet.QueryTables.Add(Connection:="TEXT;TxtFile", _
Destination:=Cells(Rows.Count, "A").End(xlUp)(2))
.Refresh BackgroundQuery:=False
End With
Code:
.Refresh BackgroundQuery:=False