|
大神们,问题是这样的,打开一个Word文件(.docx),这个文件中含有文字、图片和表格,以下代码得不到"2.htm""3.htm"请问如何改代码?谢谢。
Sub t1()
Dim fPath As String, fName As String
Dim wordApp As Object '声明VBA的word应用程序实例对象 '后期绑定
Dim wordDoc As Object '声明文件(.doc)对象 '后期绑定
On Error Resume Next
fPath = "D:\z\" '路径字符串'MS Office Format
fName = "0.docx"
Set wordApp = CreateObject("Word.Application") '为变量赋值
Set wordDoc = Documents.Open(fPath & fName) '
'wordDoc.SaveAs fPath & "1.pdf", wdFormatPDF
'wordDoc.SaveAs fPath & "2.htm", wdFormatHTML
wordDoc.SaveAs Filename:=fPath & "3.htm", FileFormat:=wdFormatHTML, _
LockComments:=False, Password:="", AddToRecentFiles:=False, WritePassword:="", _
ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, _
SaveFormsData:=False, SaveAsAOCELetter:=False, CompatibilityMode:=0
wordDoc.Close '关闭word
wordApp.Quit
Set wordDoc = Nothing
Set wordApp = Nothing
End Sub '
|
|