unixfreak0037 / officeparser

Extract embedded files and macros from office documents.
http://empieria.com/blog/?page_id=10
MIT License
177 stars 60 forks source link

Rebuilding the vbaProject.bin #5

Open dweedul opened 12 years ago

dweedul commented 12 years ago

Would it be possible to reverse part of the process used in the extract-macros code to rebuild the vbaProject.bin file within a new file.

I'm looking at this as a way to easily allow git versioning of the code and settings for a vba project.

unixfreak0037 commented 12 years ago

I'm not sure what you man by this. Can you elaborate?

dweedul commented 12 years ago

Currently, you can extract the code modules from the vbaProject.bin. I was curious if the process in the --extract macros code could be used to piece together the streams necessary to rebuild the binfile from the extracted files.

I currently have an excel addin that I wrote that does most of this, but it gets cumbersome when I have to load code back into the project.

A script that could do that recompilation would be super helpful in rebasing, jumpin around branches, etc as I would not have to deal with the crap associated with my addin.

unixfreak0037 commented 12 years ago

That's interesting. That's actually a direction I wanted to go a long time ago, to be able to create these OLE documents and specify all the settings and inputs on the command line. I think that would not only be useful for my own research purposes, but some other open source projects could probably use that as well.

Rather than merge something like that into the main branch, I think we should create a new branch with the goal of being able to create rather than disassemble, and the first thing we could target is the reassembly of the vbaProject.bin.

From a technical perspective, if what you're rebuilding is exactly what was extracted, then that would be pretty easy. To go the other way around might be a little more difficult but definitely not impossible.

Beakerboy commented 5 years ago

I know this is an old issue...but it’s still open so it’s fair game, right? I host some VBA code on GitHub and I can see a huge use case for this. If I merge a pull request to master, I could use TravisCI to take my code, build it into an excel add-in and push the result back to GitHub as a release, completing the automated CI cycle.