dantheman9
Board Regular
- Joined
- Feb 5, 2011
- Messages
- 175
HI I importing some text files as part of a bigger Sub, I have all the path imfomation for each text file from other parts of the Sub (which include a textbox for the folder path and then the file name is formed earlier in the Sub).
The sub always stops at the text import, I can't work how to get it working..relevent code below;
Im sure it must be something simple in the TEXT line but can't work it out?
Thanks
Dan
The sub always stops at the text import, I can't work how to get it working..relevent code below;
Code:
rFname = Userform1.Fwatch & stripedt '[COLOR=red]where userform1.Fwatch is folder 'path[/COLOR]
[COLOR=#ff0000]'stripedt is the file name with txt extention on.[/COLOR]
NewShtt.Activate
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & rFname _
, Destination:=Range("$A$1"))
.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 = d
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileCommaDelimiter = True
.TextFileColumnDataTypes = Array(9, 1, 1, 9, 1, 1, 9, 9, 9)
.TextFileTrailingMinusNumbers = True
[COLOR=red].Refresh BackgroundQuery:=False ' code breaks here
[/COLOR] End With
Im sure it must be something simple in the TEXT line but can't work it out?
Thanks
Dan