英文:
Forward email items as attachment one by one by excel vba
问题
I have many email items.
I put them in my Excel from Outlook, now I can reply to all of them using Excel VBA, but I can't forward them as attachments to the department using Excel VBA.
I need code to help me accomplish this.
I am trying, but I don't have enough information.
英文:
I have many email items.
I put them in my excel from outlook, know I can reply all of them by excel vbn, but i can't forward as attachment to department. by excel vbn
I need code to help me to do it
I am trying but I don't have enough information
答案1
得分: 2
你需要创建一个新的MailItem
实例,然后将原始项目作为附件附加:
Set objMsg = Application.CreateItem(olMailItem)
With objMsg
.Attachments.Add objItem, olEmbeddeditem
.Subject = "SPAM"
.To = "spam@host.co.uk"
.Send
End With
Attachments.Add 方法在Attachments
集合中创建一个新的附件。附件的源可以是文件(由完整的文件系统路径和文件名表示)或构成附件的Outlook项目。
你可能会发现如何:以编程方式创建和发送Outlook消息这篇文章有帮助。
英文:
You need to create a new MailItem
instance and then attach the original item as an attachment:
Set objMsg = Application.CreateItem(olMailItem)
With objMsg
.Attachments.Add objItem, olEmbeddeditem
.Subject = "SPAM"
.To = "spam@host.co.uk"
.Send
End With
The Attachments.Add method creates a new attachment in the Attachments
collection. The source of the attachment can be a file (represented by the full file system path with a file name) or an Outlook item that constitutes the attachment.
You my find the How To: Create and send an Outlook message programmatically article helpful.
答案2
得分: 0
使用 Application.CreateItem(0)
创建新消息,然后通过将要转发的消息传递给 MailItem.Attachments.Add
来将它们作为附件添加。
英文:
Create a new message using Application.CreateItem(0)
, then add the messages you want to be forwarded as attachments by passing them to MailItem.Attachments.Add
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论