Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
insert text to a specific cell
You need three code segments: Open and Close file: Code ------------------- Public Sub open_textstream(path as string) Set fs = CreateObject("Scripting.FileSystemObject") Set file = fs.GetFile(path) filesize = file.Size 'wird im Moment nicht benötigt Set ts = file.OpenAsTextStream(1, -2) End Sub Public Sub close_textstream() ts.Close End Su ------------------- Startbutton called Start with following code Code ------------------- private sub start_click() call open_textstream("C:\test.txt") call main call close_textstream end su ------------------- Main Procedure filling the Cells: Code ------------------- sub main() do while ts.endofstream <"" data = ts.readline() dat = split(data,chr(9))'i think chr(9) was TAB for i = 0 to ubound(dat()) Cells(countrows+3,i+7) = dat(i) next i countrows = countrows + 1 loop end su ------------------- don't know if it works perfectly (written in about 1 minute ;)) Simo -- moondar ----------------------------------------------------------------------- moondark's Profile: http://www.excelforum.com/member.php...fo&userid=2739 View this thread: http://www.excelforum.com/showthread.php?threadid=47017 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I insert a photo into a specific cell? | Excel Discussion (Misc queries) | |||
How can I insert a check box into a specific cell in Excel? | Excel Discussion (Misc queries) | |||
insert a row with enter on a specific cell | Excel Discussion (Misc queries) | |||
macro to insert row after specific text | Excel Discussion (Misc queries) | |||
Insert cell/format/text/fontsize and auto insert into header? | Excel Programming |