I recorded one import sequence in a macro:
Option Explicit
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 12.02.2013 by Dima
'
'
Range("A4").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Users\Dima\Documents\NZDUSD240.csv", Destination:=Range("A4"))
.Name = "NZDUSD240"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 866
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(4, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
I wonder how do I made this macro import the data using the file name that is specified in a cell???
Bookmarks