Userform的公共字符串显示为空白-Outlook VBA

时间:2018-02-19 15:34:48

标签: vba outlook outlook-addin outlook-vba

我希望在用户表单中发送邮件之前显示第一个收件人。 但我得到一个空白标题。如果我使用msgbox测试公共字符串,则会看到它已正确接收。感谢您的帮助!

我在这个场景中的代码:

public prompt as string   

Public Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

    Dim Recipients As Outlook.Recipients
    Dim recip As Outlook.Recipient
    Dim contact As String

    Set Recipients = Item.Recipients

    Set recip = Recipients.Item
    contact = recip

    prompt = contact
    UserForm1.Show

End Sub

userform中的代码是:

Private Sub UserForm_Initialize()
    Me.Label1.Caption = prompt
end sub

0 个答案:

没有答案