本示例显示活动文档的名称,如果没有打开的文档,则显示一条消息。
If Application.Documents.Count >= 1 Then
MsgBox ActiveDocument.Name
Else
MsgBox "没有任何打开的文档。"
End If