Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you just record the add sheet and import steps as you perform them, you
get something pretty usable. I just did so with a little sample csv file I created with the following results. (macro recorder is your FRIEND!) :) Sub Macro1() Sheets.Add After:=Sheets(Sheets.Count) With ActiveSheet.QueryTables.Add(Connection:="TEXT;F:\D ata\MyData.csv", _ Destination:=Range("$A$1")) .Name = "MyData" .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 = False .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = True .TextFileSpaceDelimiter = False .TextFileColumnDataTypes = Array(2, 1, 3) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With End Sub "Anne" wrote: Hello! I am in the process of developing a quality control spreadsheet based on CSV files that are exported periodically from a scientific instrument. The CSV file always goes to the same place on the hard drive. For example, C:\ICAP\QAQC I need help on creating a macro button in the Excel 2007 workbook I'm working on to automatically go to that directory and pull in any CSV file it finds there. Once it imports the CSV as a sheet in the workbook, then I can tell it to add the data from the sheet onto a master sheet for charting purposes. But I do need some help creating a macro button to automatically pull the CSV in. Any ideas would be appreciated! Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Import txt file with fixed length from VBA | Excel Programming | |||
Help with macro. Import text file (fixed width) | Excel Programming | |||
Fixed length file import?? | Excel Programming | |||
import fixed width text file | Excel Programming | |||
Import *.asc file into excel fixed width | Excel Programming |