Hi
I have a Word Docx file. I know it's Zip. When I change extension to Zip and unpack it I can reach xml file.
How can I do this via VBA and work with XML content?
I will be grateful for your response
Jan
Hi
I have a Word Docx file. I know it's Zip. When I change extension to Zip and unpack it I can reach xml file.
How can I do this via VBA and work with XML content?
I will be grateful for your response
Jan
Grab the filename of the document. Make a copy of the file with a zip extension. There are plenty of code examples to extract files from a Zip e.g. http://www.rondebruin.nl/win/s7/win002.htm. Having extracted the files you can then process those that are amenable to VBA processing as you require.
Graham Mayor - MS MVP (Word) 2002-2019
Visit my web site for more programming tips and ready made processes
http://www.gmayor.com
I thought there is other more simple way
Thank you again gmayor
Alternatively, you can explore the .WordOpenXML and .InsertXML property and method off of a range object, if you want to modify the xml directly without having to close and re-open the document.
but this is almost as much a rabbit hole as ronde bruin's method.
_______________________________________________
Please don't cross-post without providing links to your cross-posts. We answer questions for free. Please don't waste the time of the people helping you.
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
- Frosty