通过Excel VBA在Outlook中打开新消息 [英] Open new message in Outlook by Excel VBA
问题描述
一旦完成,邮件将粘贴到新工作表,然后我必须将其复制并粘贴到Outlook中的新电子邮件。
是否有可能创建将在Outlook中打开新邮件的宏?所以我可以插入我的文本。
我可以编写直接从Excel发送的宏,但这不是我真正想要的,因为报告的某些部分必须手动查看数字。
非常感谢提前!
我找到了这个,它的工作正常!!!!
可能还有一件事 - 有可能附加打开的文档作为附件吗?
Sub CustomMailMessage()
Dim OutApp作为Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Recipient
Dim Recipients As Recipients
Set OutApp = CreateObject(Outlook.Application)
设置objOutlookMsg = OutApp.CreateItem(olMailItem)
Set Recipients = objOutlookMsg.Recipients
Set objOutlookRecip = Recipients.Add(alias@domain.com)
objOutlookRecip.Type = 1
objOutlookMsg.SentOnBehalfOfName = sales@domain.com
objOutlookMsg.Subject =测试这个宏
objOutlookMsg.HTMLBody =测试这个宏& vbCrLf& vbCrLf
'解析每个收件人的名称。
对于每个objOutlookRecip在objOutlookMsg.Recipients
objOutlookRecip.Resolve
下一个
'objOutlookMsg.Send
objOutlookMsg.Display
Set OutApp = Nothing
End Sub
everyday I am handling daily reporting. Which was quite time consuming. Basically I need to send email containing brief comparison of sales yesterday with sales last week and month. That is working pretty well. Once this is done the message is pasted to new sheet and then I have to copy it and paste into new email in Outlook.
Is there a possibility to create macro that will open new message in Outlook? So I'll be able to insert my text. I am able to write macro that will send it directly from Excel but this is not something I really want to as some part of the reporting must by done by looking at numbers manually.
Many thanks in advance!
I've found this one and it is working perfectly!!!!
Just maybe one extra thing - is there a possibility to attach opened document as a attachment?
Sub CustomMailMessage()
Dim OutApp As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Recipient
Dim Recipients As Recipients
Set OutApp = CreateObject("Outlook.Application")
Set objOutlookMsg = OutApp.CreateItem(olMailItem)
Set Recipients = objOutlookMsg.Recipients
Set objOutlookRecip = Recipients.Add("alias@domain.com")
objOutlookRecip.Type = 1
objOutlookMsg.SentOnBehalfOfName = "sales@domain.com"
objOutlookMsg.Subject = "Testing this macro"
objOutlookMsg.HTMLBody = "Testing this macro" & vbCrLf & vbCrLf
'Resolve each Recipient's name.
For Each objOutlookRecip In objOutlookMsg.Recipients
objOutlookRecip.Resolve
Next
'objOutlookMsg.Send
objOutlookMsg.Display
Set OutApp = Nothing
End Sub
这篇关于通过Excel VBA在Outlook中打开新消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!