Detaching and appending same type files together via agent

i want to know if you can programmatically append attached files of the same type together via an agent… So detach them and them append them and then re-attach them or another way??? Lotusscript, Java, VBA?? Any ideas>? They are ms word and ms powerpoint files