我需要打开大量当前保存在 Publisher(2003、2007 和 2010)中的文档并将它们转换为 Word 文档。这些是简单的一页文本文档,但我有大约 1,000 个要转换。这是我的代码:
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
代码调试在
FileFormat:=wdFormatXMLDocument
我似乎无法超越这一点。