Hello!
I currently have a macro that automatically imports "DATA.txt" off of the Desktop and into EXCEL. What I was thinking of was to add a subroutine that if "DATA.txt" was not found by the program, it would open a file browsing window so the user can select the file themselves.
Can someone help with that?
Thanks, Bryan
(Current code piece)
Code:
'IMPORT the file from desktop (DATA.txt)
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Users\BK\Desktop\DATA.txt", Destination:=Range("$A$1"))
.name = "dos"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1)
.TextFileFixedColumnWidths = Array(13, 12)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With