Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you don't need to open it in the excel application...you could read the data
in as a textstream - means using the Microsoft Scripting Runtime. You'll need to open a connection to the file though. in the dev environment, set a reference the Microsoft Scripting Runtime add this code to a standard module: Option Explicit Const sFILE As String = "C:\temp\test.csv" Sub GetData() Dim textst As TextStream Dim data As Variant Dim text As String Dim rowindex As Long With New FileSystemObject Set textst = .OpenTextFile(sFILE, ForReading, False) Do Until textst.AtEndOfStream rowindex = rowindex + 1 text = textst.ReadLine data = Array(Split(text, ",")) With Cells(rowindex, 1) .Value = text .TextToColumns Cells(rowindex, 1) End With Loop textst.Close Set textst = Nothing End With End Sub "George" wrote in message ... I am working on a project that will read data from a *.csv file and process it in a new workbook. The new workbook will have the macro to handle this process. I have a couple questions: I am assuming a file must be open in order to extract data. Does the *.csv file have to be activated after the file is open in order to begin processing data? How can this be done without losing focus from the new workbook? Thanks, GeoK |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extracting data | Excel Discussion (Misc queries) | |||
extracting data from one sheet based on data in another - VLookup? | Excel Worksheet Functions | |||
etract unique data from multiple workbooks after extracting data | Excel Programming | |||
Text parsing - Extracting data from inconsistent data entry format. | Excel Programming | |||
Extracting Data for .Txt Files By Unique Field Data | Excel Discussion (Misc queries) |