![]() |
|
#4
|
||||
|
||||
|
Try the following macro:
Code:
Sub ConvertXMLDocuments()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, strDocNm As String, wdDoc As Document
strDocNm = ActiveDocument.FullName
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.xml", vbNormal)
While strFile <> ""
If strFolder & "\" & strFile <> strDocNm Then
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
With wdDoc
.SaveAs2 FileName:=Split(.FullName, ".xml")(0) & ".docx", FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=False
.Close SaveChanges:=False
End With
End If
strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| open custon files, convert to Word, print/save to PDF | mgl_8 | Word VBA | 6 | 04-13-2018 03:38 PM |
| How can convert MSOffice .xml files to .doc or .pdf? | FelipeGar | Word VBA | 5 | 06-05-2015 04:51 AM |
| Convert old PowerPC file to Intel-based files in Word? | walmar | Word | 0 | 06-12-2013 07:07 AM |
Convert word files to html including hyperlink file types
|
MikS | Word | 3 | 06-12-2012 05:39 AM |
| Convert JML files | Lundberg | Word | 5 | 09-11-2010 11:05 AM |