ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how do i make macro program on excell for create new txt file? (https://www.excelbanter.com/excel-programming/364592-how-do-i-make-macro-program-excell-create-new-txt-file.html)

Richard

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

Don Guillett

how do i make macro program on excell for create new txt file?
 
use datafilterautofilterrecord a macro

--
Don Guillett
SalesAid Software

"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




Tom Ogilvy

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





All times are GMT +1. The time now is 04:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com