![]() |
|
|
|
#1
|
||||
|
||||
|
Hi Felipe,
A Word macro can be used to process thousands of files, without the user having to do any more than select the folder to process. I have posted a number of such macros here. Assuming the xml files are in a format Word can open, you can use code like: Code:
Sub XML2PDF()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, wdDoc As Document
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.xml", vbNormal)
While strFile <> ""
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
wdDoc.SaveAs2 FileName:=strFolder & "\" & Split(strFile, ".xml")(0) & ".pdf", Fileformat:=wdFormatPDF, AddToRecentFiles:=False
wdDoc.Close
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] |
|
#2
|
|||
|
|||
|
Hello ,
Actually the macro works fine but the issue is ,it is trying to open the info path form with .XML extension to Microsoft word due to which only the data is getting fetched the order/look and feel is not getting fetched .Only the data is getting converted to the PDF format. Request you to please make some change to the macro so that the proper structure gets fetched and gets converted to PDF format . Thanks Attamjot |
|
| Tags |
| convert, xml in ms word |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
convert multiple csv files to multiple excel files
|
mit | Excel | 1 | 06-14-2011 10:15 AM |
| Bulk convert Powerpoint XML files to PPT or PPTX | RileyT | PowerPoint | 0 | 11-21-2010 04:16 PM |
| Convert JML files | Lundberg | Word | 5 | 09-11-2010 11:05 AM |
| can I index or convert old msworks files to be searchable? | elijah | Word | 0 | 02-10-2010 01:57 PM |
| How 2 retain MSOffice "Upgraded" on full restore | misterbobthetomato | Office | 0 | 02-04-2007 11:08 AM |