Outlook) (Application.Explorers 屬性

回傳一個 Explorers 集合物件,該物件包含代表所有開啟 Explorer 的物件。 唯讀。

語法

expressionExplorers

expression 代表 Application 物件的變數。

範例

下面的 Microsoft Visual Basic for Applications (VBA) 範例會顯示開啟的瀏覽器視窗數。

Private Sub CountExplorers() 
 
 MsgBox "There are " & _ 
 
 Application.Explorers.Count & " Explorers." 
 
End Sub

以下 VBA 範例使用 Selection 集合的 Count 屬性與 Item 方法,由 Selection 屬性回傳,顯示在顯示收件匣的檔案總管中所選郵件項目的所有寄件人。 若要執行此範例,在顯示 [收件匣] 的瀏覽器中至少必須選取一個郵件項目。 如果所選取的項目不是郵件項目,例如選取了工作要求,則您可能會收到一個錯誤,因為在 TaskRequestItem 物件中並沒有 SenderName 屬性。

Sub GetSelectedItems() 
 
 Dim myOlExp As Outlook.Explorer 
 
 Dim myOlSel As Outlook.Selection 
 
 Dim MsgTxt As String 
 
 Dim x As Integer 
 
 
 
 MsgTxt = "You have selected items from: " 
 
 Set myOlExp = Application.Explorers.Item(1) 
 
 If myOlExp = "Inbox" Then 
 
 Set myOlSel = myOlExp.Selection 
 
 For x = 1 To myOlSel.Count 
 
 MsgTxt = MsgTxt & myOlSel.Item(x).SenderName & ";" 
 
 Next x 
 
 MsgBox MsgTxt 
 
End If 
 
End Sub

另請參閱

Application 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應