Change code in vbaProject.bin programmatically with C#

Jul 9 2009 9:59 AM

Hi,
I'm trying to insert vba code in a word .docm file through vbaProject.bin. I'm planning to use C# for this task. The part to change it to zip or use the System.IO.Packaging to open up the file doesn't seam to be a problem.
Through this tutorial:
http://www.codeproject.com/KB/cs/office2007bin.aspx?fid=333613&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2005497
I understand that the vbaProject.bin is a OLE document container tree and that the vba code is inside a stream.
If I convert the byte array stream to a string I get a lot of junk and not a clear vba code string.
I hope this can be solved without installing any office product because I'm forced to run solution as lightweight as possible.
I would appreciate your advice on this.

Answers (1)