Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
How do I insert a photo into a specific cell? Artemis Bob Excel Discussion (Misc queries) 4 May 16th 10 09:27 AM
How can I insert a check box into a specific cell in Excel? Biggles Excel Discussion (Misc queries) 1 June 21st 07 12:05 PM
insert a row with enter on a specific cell Oakie Excel Discussion (Misc queries) 4 July 28th 06 05:22 PM
macro to insert row after specific text Luke Excel Discussion (Misc queries) 2 September 19th 05 04:06 PM
Insert cell/format/text/fontsize and auto insert into header? Unfurltheflag Excel Programming 2 November 3rd 04 05:39 PM


All times are GMT +1. The time now is 08:50 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"