Hello,
I am trying to import 4 separate csv files from 4 different servers into an excel sheet.I want to write a macro which will automate this.Also, i want to append the name of the server for each file in next free column.
How do i ensure that the next csv file does not overwrite the previous import.i.e to make sure that next free cell (*,1) is selected before the next import.Here is what i have been able to generate so far:
I am trying to import 4 separate csv files from 4 different servers into an excel sheet.I want to write a macro which will automate this.Also, i want to append the name of the server for each file in next free column.
How do i ensure that the next csv file does not overwrite the previous import.i.e to make sure that next free cell (*,1) is selected before the next import.Here is what i have been able to generate so far:
Code:
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\Forcados\My Documents\My Data Sources\Output.NET\ssh\ssh1_list.csv" _
, Destination:=Range("A1"))
.Name = "LAG-BSC_list"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = True
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
ActiveWindow.SmallScroll Down:=15
Range("A41").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\Forcados\My Documents\My Data Sources\Output.NET\ssh\ssh1_list.csv" _
, Destination:=Range("A41"))
.Name = "IBD-BSC_list"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = True
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Comment