7,763
社区成员
发帖
与我相关
我的任务
分享
Dim WordObj As Word.Application
Set WordObj = Word.Application
For i = 1 To WordObj.Documents.Count
Debug.Print WordObj.Documents(i).Name
Next
Private Sub Command1_Click()
Dim xlApp As Excel.Application
Dim i As Long
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
On Error GoTo 0
If xlApp Is Nothing Then
MsgBox "没有打开 Excel", vbInformation
Exit Sub
End If
For i = 1 To xlApp.Workbooks.Count
Debug.Print xlApp.Workbooks(i).Name
Next
Set xlApp = Nothing
End Sub