PDA

View Full Version : Store XML File in Office Package



gogogogogo
04-14-2011, 01:24 AM
Hi,

I have a need to create an Office 2007 add-in that is able to create/use information stored behind the scenes (i.e. hidden from the user) in users excel workbooks and is able to be distributed along within the office excel zip file package (e.g. excel workbook .xlsx).

I do not want to store information in an application specific mechanism (i.e. hidden spreadsheets or modules), but was thinking of one or more XML documents which could be referenced and manipuated using the VBA held in the add-in for eaach workbook.

So my question is can files be stored/access directly within the Office 2007 file package using VBA? If so how to do it (I have searched the www to no success :help).

JP2112
04-18-2011, 06:55 AM
You could try taking a .xlsx file, renaming it to .zip and then unzipping it. Add your file and then re-zip it and rename it back to .xlsx. Not sure if it would work, though.

Here's a thread I found that might help:

http://social.technet.microsoft.com/Forums/en-US/excel/thread/548e2842-b419-4657-bfcf-3dfa9d5a15be

gogogogogo
04-21-2011, 02:40 AM
Thanks for the reply JP, however I was hoping to do the 'live' workbook package manipulation by using add-in code to store user interaction with a form into an XML document (rather than manually change file extension, manually copy file across, etc) in the open workbook package. The VBA would then also need to open/read from this XML document when the workbook is also open.

JP2112
04-25-2011, 07:48 AM
Why does it have to be XML? Why not use the worksheet included in the add-in? Or use a text file.

Bob Phillips
04-26-2011, 05:58 AM
Take a look at a slightly different way of getting XML http://bit.ly/gLBUbN