Outlook Script Question about using TXT.File

B

bbnimda

Hi All,

I'm use a custom Form , and store some information to .txt file, all is ok
I store / save and read these information without any Pb, but from time to
time I need to replace a the content of a line and I don't found the
command that allow me to replace a line knowing it row

to add line I use something like this

Set objFile = objFSO.OpenTextFile(myfile,forereading)
myNewitem
objFile.WriteLine(myNewitem)
......

and to read the file I put the content of the file to a list and get the
info from this list
 
M

Michael Bauer [MVP - Outlook]

Am Thu, 4 Dec 2008 16:49:53 +0100 schrieb bbnimda:


That object offers a ReadLine function, did you try that?

i don't know how that function works. I'd read all the file, then use the
Split function. If you split all the content by the line delimiter, which
usually is vbCRLF, an array will be returned with one item per line.

--
Viele Gruesse
Michael Bauer - MVP Outlook

: Outlook-Kategorien? Category Manager ist die Lösung
: VBOffice Reporter für Datenanalyse & Berichte
 
B

bbnimda

I know Readline to get the content of the line but what I want to do is
to replace the content of a line by new information

eg:

the content of the line 75 is:

AAAAAAAAAAAAAAAAAAA BBBBBBBBBBBBBBB

I Want to replace the line 75 by
BBBBBBBBBBBBBBB BBBBBBBBBBBBBBB

I hope it's clear
 
M

Michael Bauer [MVP - Outlook]

Sorry, I didn't mean the ReadLine but the WriteLine function. However, try
my suggestion: If you have all of the lines in an array, you can change them
easily and then write everything back. That shouldn't be a problem as long
as you don't have to write very huge files.
--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Fri, 5 Dec 2008 10:33:37 +0100 schrieb bbnimda:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top