[英]How do I override the Share/Email/Save as Attachment in Excel 2013 with a custom macro
We have recently upgraded from Office 2003 to Office 365. 我们最近已从Office 2003升级到Office 365。
I used to override the File/Send
feature with a macro that would check whether the current file was a confidential company file (by name). 我曾经用一个宏覆盖File/Send
功能,该宏将检查当前文件是否为机密公司文件(按名称)。 If it was then it would block the send. 如果是这样,它将阻止发送。 If it wasn't then it would open an email with the file attached. 如果不是,那么它将打开带有附件的电子邮件。
Sub sendme()
aName = ActiveWorkbook.Name
Flag = True
If InStr(UCase(aName), "CONFIDENTIAL FILE") Then Flag = False
If Flag = False Then MsgBox "You are trying to email " + aName + ". This action has been blocked.", vbCritical: End
Mail_with_outlook
End Sub
Sub Mail_with_outlook()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strto As String
Dim strcc As String
Dim strbcc As String
Dim strsub As String
Dim strbody As String
Dim sh As Worksheet
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
If InStr(ActiveWorkbook.FullName, "\") = 0 Then
MsgBox "Please save workbook before continuing", vbCritical
End
End If
strto = ""
strsub = ""
strbody = "Special signature"
With OutMail
.To = strto
.CC = strcc
.BCC = strbcc
.Subject = strsub
.Body = strbody
.Attachments.Add ActiveWorkbook.FullName
.Display
End With
End Sub
How do I do the same thing in Excel 2013 - to override the Share/Email/Save as Attachment
in Excel 2013 with a custom macro ? 如何在Excel 2013中执行相同操作-使用自定义宏覆盖Excel 2013中的Share/Email/Save as Attachment
?
It seems to me that this is impossible. 在我看来,这是不可能的。 The only thing possible seems to me to be is to add the code functionality to a button on an addin, and ask the users to use this button to send the email 在我看来,唯一可能的是将代码功能添加到插件上的按钮,并要求用户使用此按钮发送电子邮件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.