Advertisement
Guest User

Untitled

a guest
Feb 16th, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. Sub Import()
  2. ' Imports file '
  3. Application.ScreenUpdating = False
  4. Dim WS As Worksheet, strFile As String
  5. Set WS = ActiveWorkbook.Sheets("Invest")
  6. strFile = Application.GetOpenFilename("Text Files (*.csv),*.csv", , "Please selec text file...")
  7. With WS.QueryTables.Add(Connection:="TEXT;" & strFile, _
  8. Destination:=WS.Range("A1"))
  9. .FieldNames = True
  10. .RowNumbers = False
  11. .FillAdjacentFormulas = False
  12. .PreserveFormatting = True
  13. .RefreshOnFileOpen = False
  14. .RefreshStyle = xlInsertDeleteCells
  15. .SavePassword = False
  16. .SaveData = True
  17. .AdjustColumnWidth = True
  18. .RefreshPeriod = 0
  19. .TextFilePromptOnRefresh = False
  20. .TextFilePlatform = 850
  21. .TextFileStartRow = 1
  22. .TextFileParseType = xlDelimited
  23. .TextFileTextQualifier = xlTextQualifierDoubleQuote
  24. .TextFileConsecutiveDelimiter = False
  25. .TextFileTabDelimiter = True
  26. .TextFileSemicolonDelimiter = False
  27. .TextFileCommaDelimiter = True
  28. .TextFileSpaceDelimiter = False
  29. .TextFileTrailingMinusNumbers = True
  30. .Refresh BackgroundQuery:=False
  31. End With
  32. ' Imports file '
  33. '''''''
  34. 'RUN MACRO CODE HERE
  35. '''''''
  36. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement