Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What am i doing wrong

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm trying to import a textfile into Excel. I´ve made a variable with a path in it named SelectedFile but it dosn't import the file. I,ve tested the SelectedFile and it does contain a path. If i replace the "TEXT;SelectedFile" with "TEXT;C:\Textfile" it does work. So What am I doing wrong



With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;SelectedFile" _
, Destination:=Range("A1"))
.Name = "vika"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = False
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(8, 5, 8, 8, 8, 5, 8, 7, 1, 9, 5, 5, 5)
.Refresh BackgroundQuery:=False
End With


Thanks in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top