Create New Word document XML format

Dossfm0q

Banned User
Joined
Mar 9, 2009
Messages
570
Office Version
  1. 2019
Platform
  1. Windows
Good Day All how to create new Word 2010 XML Format and later by create folders are need and fill with required XML

thanks

Code:
Sub creatWordXml()




Dim FilePath As String, docPropsFolder As String, relsFolder As String, wordFolder As String, relsFolder1 As String, themeFolder As String




    Dim objShell As Object
    Dim strWordExe As String
    Set objShell = CreateObject("WScript.Shell")
    strWordExe = objShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe\")
 
 
FilePath = ThisWorkbook.Path & "\"


'Folders Path
RootFolder = FilePath & "root"
    docPropsFolder = RootFolder & "\" & "docProps"
    relsFolder = RootFolder & "\" & "_rels"
    wordFolder = RootFolder & "\" & "word"
        relsFolder1 = wordFolder & "\" & "_rels"
        themeFolder = wordFolder & "\" & "theme"
' creat Folders
If Len(Dir(RootFolder, vbDirectory)) = 0 Then MkDir RootFolder
    If Len(Dir(relsFolder, vbDirectory)) = 0 Then MkDir relsFolder
    If Len(Dir(docPropsFolder, vbDirectory)) = 0 Then MkDir docPropsFolder
    If Len(Dir(wordFolder, vbDirectory)) = 0 Then MkDir wordFolder
        If Len(Dir(wordFolder, vbDirectory)) = 0 Then MkDir wordFolder
        If Len(Dir(wordFolder, vbDirectory)) = 0 Then MkDir wordFolder
            If Len(Dir(relsFolder1, vbDirectory)) = 0 Then MkDir relsFolder1
            If Len(Dir(themeFolder, vbDirectory)) = 0 Then MkDir themeFolder


''' Here I want macro to get below XML
'.rels
'app.XML
'core.XML
'custum.XML
'document.XML.rels
'theme.xml........and other
'[Content_Types].XML
Shell strWordExe & " " & FilePath & "\" & "New Word.docx", vbMaximizedFocus




End Sub
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top