2014-10-20 3 views
0

현재 Publisher (2003, 2007 및 2010)에 저장된 많은 양의 문서를 열어 Word 문서로 변환해야합니다. 이것들은 간단한 한 페이지짜리 텍스트 문서이지만 약 1,000 개가 변환되어 있습니다.폴더에서 Publisher 파일을 열고 Word 문서로 저장

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 

에서 나는이 시점 과거를 얻을 수없는 것 : 여기 내가 가지고있는 코드입니다.

답변

0

확실하지 Excel에서 그 일을하는 이유 :하지만, 당신이 Filename:MyFile & ".docx" 대장 누락있는 것처럼

편집 : wdFormatXMLDocument 당신이 제작사에서 매크로를 실행하기 때문에 정의, 그래서 가장 쉬운되지 않을 수 있습니다 12로 대체 할 수 있습니다.

관련 문제