Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Import()
- ' Imports file '
- Application.ScreenUpdating = False
- Dim WS As Worksheet, strFile As String
- Set WS = ActiveWorkbook.Sheets("Invest")
- strFile = Application.GetOpenFilename("Text Files (*.csv),*.csv", , "Please selec text file...")
- With WS.QueryTables.Add(Connection:="TEXT;" & strFile, _
- Destination:=WS.Range("A1"))
- .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 = 1
- .TextFileParseType = xlDelimited
- .TextFileTextQualifier = xlTextQualifierDoubleQuote
- .TextFileConsecutiveDelimiter = False
- .TextFileTabDelimiter = True
- .TextFileSemicolonDelimiter = False
- .TextFileCommaDelimiter = True
- .TextFileSpaceDelimiter = False
- .TextFileTrailingMinusNumbers = True
- .Refresh BackgroundQuery:=False
- End With
- ' Imports file '
- '''''''
- 'RUN MACRO CODE HERE
- '''''''
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement