Appending to File

P

Progster

I've got a large macro which reads an input file, massages it in various
ways, and then writes multiple output files. Here is the code that writes
the output files. The key point is that already existing copies of the
files are simply overwritten.


' Upon reaching the end of the input file, activate each of the output
document files
' in turn and write them out.
If EOF(1) Then
Close #1
'Set MyOpen = Nothing
'iOpen = 0
'GoTo again:
For i = 0 To iNoFiles
Windows(sFileName(i)).Activate
ActiveDocument.SaveAs FileName:=sFileName(i),
fileformat:=wdFormatText
ActiveDocument.Close ' close the Word document after saving it
Next
End
End If


I would like to be able to append instead of overwrite. IOW, there may be
preexisting copies of any of the sFileName(i) files already on disk. If so,
I don't want to overwrite them, I want to append the new document (in Word)
to the old document (on disk).

I would appreciate any tips (or code) which would guide me in how to do
this. Thanks!
 

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