Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding additional text to an already written file

Status
Not open for further replies.

Shadowcat2021

Technical User
Apr 27, 2010
1
US
Okay I need help trying to add paragraphs not lines but full text. Here is a code that i build in order add the text to a file.

Code:
Dim fiParagraph
Dim fsoParagraph
set fsoParagraph = CreateObject("Scripting.FileSystemObject")
set fiParagraph = fsoParagraph.OpenTextFile("C:\Hosts.txt", 2, true)

if err.number = 0 then
    fiMessage.write vendorparagraph
    fiMessage.close
end if

set fiMessage = nothing
set fsoMessage = nothing


I got a message when I start it it reads object required: fiMessage
 
Tip: use the Option Explicit[/i] instruction.
fiMessage is not the same as fiParagraph.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
You might also want to define the text format when opening the file - wouldn't want to write unicode to an ascii file. Also, you are opening the file for writing (2) which means the char pointer is set to the first bit. With append (8), the pointer is set to the last bit in the file.

Code:
const ASCII = 0
set fiParagraph = fsoParagraph.OpenTextFile("C:\Hosts.txt", [red]8[/red], true, [red]ASCII[/red])

-Geates
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top