Consulting

Results 1 to 4 of 4

Thread: How to work with Word file in Xml with VBA

  1. #1
    VBAX Regular
    Joined
    Jun 2016
    Posts
    11
    Location

    Question How to work with Word file in Xml with VBA

    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

  2. #2
    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

  3. #3
    VBAX Regular
    Joined
    Jun 2016
    Posts
    11
    Location
    I thought there is other more simple way
    Thank you again gmayor

  4. #4
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •