JavaScript: Out of the question. Acrobat can't handle that amount of information. I'm guessing the same applies for VBA as well.
I have developed a stand-alone application, written in Java, that can do it. If you're interested in such a tool feel free to contact me privately (try6767 at gmail.com) to discuss it further.