'我对VBA不太熟,以下代码可能存在一定问题,你自己修改一下看行不行
Dim wdApp As Word.Application
Dim wdDoc As Word.DocumentPrivate Sub Command1_Click()
Set wdApp = New Word.Application
wdApp.Visible = False 'True
Set wdDoc = wdApp.Documents.Open("c:\temp\文档1.DOC")
Set myRange = ActiveDocument.Content
Documents(1).Repaginate
Pages = ActiveDocument.BuiltInDocumentProperties(wdPropertyPages).Value
Documents(1).Close False
MsgBox "文档1共有" & CStr(Pages) & "页"
wdApp.Quit
Set wdDoc = Nothing
End Sub
Dim wdApp As Word.Application
Dim wdDoc As Word.DocumentPrivate Sub Command1_Click()
Set wdApp = New Word.Application
wdApp.Visible = False 'True
Set wdDoc = wdApp.Documents.Open("c:\temp\文档1.DOC")
Set myRange = ActiveDocument.Content
Documents(1).Repaginate
Pages = ActiveDocument.BuiltInDocumentProperties(wdPropertyPages).Value
Documents(1).Close False
MsgBox "文档1共有" & CStr(Pages) & "页"
wdApp.Quit
Set wdDoc = Nothing
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货