我有一个程序可以检测附件的文件大小,如果它大于预定义的大小,就会显示一个MsgBox。
我的问题是,除了使用MsgBox,是否可以使用自定义的内联彩带或横幅?下面是我想要重现的一个例子的图像。具体地说,我希望在电子邮件正文上方重新创建粉色横幅,而不是在文件大小满足大小标准时弹出MsgBox,否则它看起来完全正常。
http://gaspull.geeksaresexytech.netdna-cdn.com/wp-content/uploads/2008/03/outlook1.jpg
谁能给我指出一个来源或参考资料来做更多的功课?我在谷歌上搜索过,但我认为我没有搜索到正确的关键字,因为我的搜索总是出现其他的东西。
发布于 2014-01-30 01:57:45
我建议修改代码,在MailItem.HTMLBody中插入一些超文本标记语言。
这取决于你使用HTML的技巧(这不是我的强项……)您可能会非常接近该通知的外观和感觉。
然后,您可以使用ItemSend事件来确定如何处理电子邮件。
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Select Case TypeName(Item)
Case "MailItem"
If InStr(1, Item.HTMLBody, GetWarningMessage) Then
'If you want to cancel the send, then do this:
Cancel = True
MsgBox "Attachment is too big to send!"
'Or, if you want to send anyways, do this:
'Item.HTMLBody = Replace(Item.HTMLBody, GetWarningMessage, vbNullString)
End If
Case Else
'Do nothing, or modify as needed
End Select
End Sub您需要修改此函数以返回代表您的警告消息的正确子字符串。我使用了简单的文本突出显示等,但我认为您可以使用形状或智能艺术等。
Function GetWarningMessage() As String
Dim str$
str = "<p class=MsoNormal><b><span style='color:red;background:silver;mso-highlight:silver'>Warning:</span></b><span style='color:red;background:silver;mso-highlight:silver'> </span><span style='background:silver;mso-highlight:silver'>This message contains an attachment that is too large to send.</span><o:p></o:p></p>"
GetWarningMessage = str
End Functionhttps://stackoverflow.com/questions/21436562
复制相似问题