Hi,
I am very, VERY new to VBA so apologies if this is general knowledge.
I am writing a macro that takes a dump of data in a text file, converts it to columns in excel and copies it to an Access Database.
My code for opening the text file is simply
Dim TxtFileName as String
TxtFileName = "C:\Users\7092\Desktop\Current Work\sqlexec.txt"
Workbooks.OpenText Filename:=TxtFileName, Origin:=437, StartRow:=1,
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote,
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False,
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1)),
DecimalSeparator:=".", ThousandsSeparator:=",", TrailingMinusNumbers:=True
However, what i would like is for the user to be able to browse to find the text file and if it isn't too much trouble, for a warning to be presented if they try to choose a file that isn't a txt file.
Thanks in advance for any help you can give me.
J
Bookmarks