我可以创建一个宏,为 Outlook 2010 中的主题提供下拉菜单吗?

我可以创建一个宏,为 Outlook 2010 中的主题提供下拉菜单吗?

我需要 Outlook 邮件的主题行以邮件所涉及的工作开头。由于在任何特定时间都有大约十几个工作正在进行,因此输入工作名称或从另一封邮件中复制粘贴都很麻烦。我一直在使用 Outlook 菜单上的一个按钮来创建新邮件的宏,但现在我只能将一项工作作为主题,还没有弄清楚如何为自己提供一个包含所有可能工作名称的下拉菜单。因此,任何帮助都将不胜感激。

答案1

尝试这样做。确保启动时有一个未完成的项目。

http://www.vbaexpress.com/kb/getarticle.php?kb_id=369

http://www.vbaexpress.com/kb/getarticle.php?kb_id=303

'** The following code goes in a userform **

' Adapted for a single choice

Private Sub cmdOkay_Click()
Dim i As Long
Dim msg As String
Dim Check As String

Dim currItem As MailItem

'Generate a list of the selected items
With ListBox1
    For i = 0 To .ListCount - 1
        If .Selected(i) Then
            msg = .List(i)
            Exit For
        End If
    Next i
End With

If msg = vbNullString Then
    'If nothing was selected, tell user and let them try again
    MsgBox "Nothing was selected!  Please make a selection!"
    Exit Sub

Else

    Set currItem = Application.ActiveInspector.currentItem
    currItem.Subject = msg
    Unload Me

End If

End Sub

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub UserForm_Initialize()

With Me.ListBox1
     'Clear the rowsource in case it has been set
    .RowSource = ""
     'Add the items
    .AddItem ("Cat")
    .AddItem ("Dog")
    .AddItem ("Gerbil")
    .AddItem ("Lizard")
    .AddItem ("Rat")
    .AddItem ("Snake")
    .AddItem ("Turtle")
End With

End Sub


 '** The following code goes in a standard module **

Sub Launch()
'This code will launch the userform
    UserForm1.Show
End Sub

相关内容