LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Need help trying to open a file and stream data into a sheet...

I have finished writing my program but need help in getting the data
into sheet2. In sheet1 a command button is supposed to have the user
select a file, have the data streamed to sheet2 and delimit it using
the comma.

So far I have this: (partly from vba help in excel and vba excel
book)


filetoopen = Application.getopenfilename("Data Files (*.asc),
*.asc")

Dim fs, f

Set fs = createobject("Scripting.filesystemobject")
set f = fs.opentextfile(filetoopen, 1, tristatetrue)
data = f.readall

with worksheets("sheet2").select
with data
.textfileparsetype=xldelimited
.textfilecommadelimiter=true
endwith
endwith

'data = f.readall
'worksheets("sheet2").select
'cells(1, "a")=data

The remarked above works but puts everything in cell A1.

Any help even to just stream the data to sheet2 is appreaciated. The
macro recorder is no help
The file being loaded has data from tests represent by each line
seperate by commas
ie
2,3,5.6, , 7 test1
4,7,4,8, , 10 test2 etc

Many Thanks
Susan
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does a Multi-sheet/user file open on sheet two every time? Frustrated in NJ Excel Discussion (Misc queries) 1 January 22nd 10 05:46 PM
In-sheet link to open file not working Mel[_4_] Excel Discussion (Misc queries) 0 October 2nd 09 01:05 AM
hide sheet on file open Hein Excel Discussion (Misc queries) 6 October 21st 08 11:00 PM
Bloomberg overwrites data-need to save stream of data in a new she Melanie Excel Worksheet Functions 2 December 27th 07 05:42 PM
hidden sheet to record open of file vcff Excel Discussion (Misc queries) 0 December 1st 06 01:06 AM


All times are GMT +1. The time now is 06:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"