I need to open a large amount of documents that are currently saved in Publisher (2003, 2007, and 2010) and convert them to Word documents. These are simple one page text documents but I have about 1,000 of them to convert. Here is the code I have:
Public Sub Pub_To_Word()
Dim FS As New FileSystemObject
Dim pubApp As Publisher.Application
' Reference Library pointing to:
' Microsoft Scripting Runtime
' Microsoft Word 14.0 Object Library
Dim FSfolder As Folder
Dim MyFile As File
Dim mydoc As Document
Dim sFolderPath As String
Dim Table As Table
sFolderPath = "I:\My Documents\Publisher Test"
Set FSfolder = FS.GetFolder(sFolderPath)
For Each MyFile In FSfolder.Files
Set mydoc = pubApp.Open(MyFile)
Application.DisplayAlerts = False
mydoc.SaveAs Filename:MyFile & ".docx", FileFormat:=wdFormatXMLDocument
mydoc.Close savechanges:=True
pubApp.DisplayAlerts = True
End If
Next
End
End Sub
The code debugs at
FileFormat:=wdFormatXMLDocument
I can't seem to get past this point.