Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default how do i make macro program on excell for create new txt file?

Hi all,

is there anyone can help me, I need make simple macro program.
I have a text file, inside this txt file there is certain code. Example
there is code 30 on line 10-15. I need a program that copy line 10-15 and
create a new file with the content only line 10 until 15 only. Thanks all
your help guys.

Best regards
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default how do i make macro program on excell for create new txt file?

Here is a link to sample code to read and write delimited files:

http://www.cpearson.com/excel/imptext.htm import/export text files

here is sample code to read in a text file:

Sub ReadStraightTextFile()
Dim sStr as String
Dim LineofText As String
Dim rw as Long
rw = 0
Open "C:\FILEIO\TEXTFILE.TXT" For Input As #1
sStr = ""
Do While Not EOF(1)
Line Input #1, LineofText
sStr = sStr & lineofText
if len(sStr) = 178 then
rw = rw + 1
cells(rw,1).Value = sStr
sStr = ""
End if
Loop
'Close the file
if len(sStr) 0 then
cells(rw,1).Value = sStr
End if
Close #1
End Sub

Here are other sources of information:


http://support.microsoft.com/default...b;en-us;151262
Working with Sequential Access Files

http://www.applecore99.com/gen/gen029.asp

--
Regards,
Tom Ogilvy


"Richard" wrote in message
...
Hi all,

is there anyone can help me, I need make simple macro program.
I have a text file, inside this txt file there is certain code. Example
there is code 30 on line 10-15. I need a program that copy line 10-15 and
create a new file with the content only line 10 until 15 only. Thanks all
your help guys.

Best regards



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 to create a macro button to exit a program PACEBIT0708 Excel Worksheet Functions 1 April 23rd 08 04:43 PM
create a slides show with excell spreadsheets using excell wantabepas Charts and Charting in Excel 0 June 16th 06 07:46 PM
How do I use info from an excel program and make file labels? Label maker Setting up and Configuration of Excel 1 November 30th 05 03:46 PM
how do i create a short cut on my desktop for a excell file? Gary Excel Discussion (Misc queries) 3 February 3rd 05 06:00 PM
How to I create a macro in Excell to add multiple worksheets? TBarnes Excel Programming 2 October 21st 04 04:46 PM


All times are GMT +1. The time now is 11:54 PM.

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

About Us

"It's about Microsoft Excel"