Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Appending a file
Hello,
I have the following code to combine the contents of all the text files in one folder, into one single text file. The problem is, I get an error 70 Permisson denied on the second time I try to open the CombindedFile. I don't beleive the file is actually being opened, but do I need to close it or deactivate it after the first write? Thanks! Sub Append_Txt() Dim oFS As FileSystemObject Dim oFS1 As FileSystemObject Dim oTS As TextStream Dim oTS1 As TextStream Dim vTemp Dim Directory As String '************* Directory = "C:\New Folder\" ChDir Directory Set oFS = New FileSystemObject Set oFS1 = New FileSystemObject f = Dir(Directory, 7) Do While f < "" Set oTS = oFS.OpenTextFile(Directory & f, ForReading) vTemp = oTS.ReadAll Set oTS1 = oFS.OpenTextFile("C:\CombinedTemp.txt", ForAppending, True) oTS1.Write (vTemp) f = Dir Loop End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
appending one Excel file to another ? | Excel Worksheet Functions | |||
Appending to a file with run-time error '54' Bad file mode | Excel Programming | |||
appending to excel file | Excel Programming | |||
Appending a second csv file | Excel Discussion (Misc queries) | |||
Appending to File | Excel Programming |