Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. Path = "\blahblahblah"
  2. Prefix = "24hr_Export_"
  3. Suffix = "_00_00_14"
  4. FName = Prefix & DayTime & Suffix & ".csv"
  5. ImportCsvFile Path & FName, ActiveSheet.Cells(1, 1)
  6.  
  7. Sub ImportCsvFile(FileName As Variant, Position As Range)
  8. With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & FileName, Destination:=Position)
  9. .Name = Replace(FileName, ".csv", "")
  10. .FieldNames = True
  11. .RowNumbers = False
  12. .FillAdjacentFormulas = False
  13. .RefreshOnFileOpen = False
  14. .BackgroundQuery = True
  15. .RefreshStyle = xlInsertDeleteCells
  16. .SavePassword = False
  17. .SaveData = True
  18. .AdjustColumnWidth = True
  19. .TextFilePromptOnRefresh = False
  20. .TextFilePlatform = xlMacintosh
  21. .TextFileStartRow = 1
  22. .TextFileParseType = xlDelimited
  23. .TextFileTextQualifier = xlTextQualifierDoubleQuote
  24. .TextFileConsecutiveDelimiter = False
  25. .TextFileTabDelimiter = True
  26. .TextFileSemicolonDelimiter = False
  27. .TextFileCommaDelimiter = False
  28. .TextFileSpaceDelimiter = False
  29. .TextFileOtherDelimiter = ","
  30. .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
  31. .Refresh BackgroundQuery:=False
  32. End With
  33. End Sub
  34.  
  35. FName = Dir("c:24hr_Export_2013_11_15_*.csv")
  36.  
  37. FName = Dir("c:24hr_Export_2013_11_15_??_??_??.csv")
  38.  
  39. FName1 = Dir("c:BCH" & "??-??" & ".xlsx")
  40. Range("A5").Select
  41. ActiveCell.FormulaR1C1 = "OK"
  42.  
  43. FName2 = Dir("c:Portafolio" & "??-??" & ".xlsx")
  44. Range("A3").Select
  45. ActiveCell.FormulaR1C1 = "OK"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement