【问题标题】:VBScript Msgbox email from Outlook address book来自 Outlook 通讯簿的 VBScript Msgbox 电子邮件
【发布时间】:2020-04-15 16:36:10
【问题描述】:

我目前有以下脚本:

Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.Session.GetSelectNamesDialog
objMail.Display   'To display address book

这将从 Outlook 打开全局地址列表。 现在,当我在联系人上单击或双击(没关系)时,我想要一个包含联系人电子邮件地址的消息框。

【问题讨论】:

    标签: vbscript outlook


    【解决方案1】:

    您可以使用以下代码获取选中的联系人:

    If .Display Then 
     'Recipients Resolved 
     'Access Recipients using oDialog.Recipients 
    End If 
    

    例如:

    Sub ShowContactsInDialog() 
     Dim oDialog As SelectNamesDialog 
     Dim oAL As AddressList 
     Dim oContacts As Folder 
    
     Set oDialog = Application.Session.GetSelectNamesDialog 
     Set oContacts = _ 
       Application.Session.GetDefaultFolder(olFolderContacts) 
    
     'Look for the address list that corresponds with the Contacts folder 
     For Each oAL In Application.Session.AddressLists 
      If oAL.GetContactsFolder = oContacts Then 
       Exit For 
      End If 
     Next 
     With oDialog 
      'Initialize the dialog box with the address list representing the Contacts folder 
      .InitialAddressList = oAL 
      .ShowOnlyInitialAddressList = True 
      If .Display Then 
       'Recipients Resolved 
       'Access Recipients using oDialog.Recipients 
      End If 
     End With 
    End Sub
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-26
      • 1970-01-01
      • 2015-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-11
      相关资源
      最近更新 更多