Forward email items as attachment one by one by excel vba.

huangapple go评论95阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年6月13日 01:30:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/76459012.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定