Help with Connection to external text data file

Joined
Apr 26, 2010
Messages
2
Reaction score
0
Hi Everyone,

I appreciate if someone advice me about how I can prompt the user to select the text data file which he want to connect to by the open file window, actually I am a beginner in that kind of programming, so I want anyone to check the below code and advice me.

Best Regards,

Sub Button4_Click()
'
' Button4_Click Macro
' connect to data file
'

'
Range("F1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;E:\My Documents\Company Index\Bertec\Copy (1)Force.", Destination:= _
Range("$A$1"))
.Name = "Copy (1)Force."
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = True
.TextFilePlatform = 720
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top