想通过这个代码从EXCEL中运行宏获取特定字符在word文档中的页码,但一直提示Selection.Information(wdActiveEndPageNumber)错误,麻烦那位大师能够指正一下,谢谢
Sub test()
Dim mypath, Newname, wApp
mypath = ThisWorkbook.Path & "\文件夹\"
Newname = "文档.doc"
Set wApp = CreateObject("word.application")
With wApp
.Documents.Open mypath & Newname
If .Selection.Find.Execute("投标人") = True Then
Sheet9.Range("C10").Value =Selection.Information(wdActiveEndPageNumber)
End If
.Quit
End With
Set wApp2 = Nothing
End Sub
Sub test()
Dim mypath, Newname, wApp
mypath = ThisWorkbook.Path & "\文件夹\"
Newname = "文档.doc"
Set wApp = CreateObject("word.application")
With wApp
.Documents.Open mypath & Newname
If .Selection.Find.Execute("投标人") = True Then
Sheet9.Range("C10").Value =Selection.Information(wdActiveEndPageNumber)
End If
.Quit
End With
Set wApp2 = Nothing
End Sub