How do I open an outlook .msg file from my harddrive that is NOT in outlook?

user2868501

I have searched high and low for this seemingly simple task, but all references I come across are either saving to the hard-drive or reading from an outlook folder.

I have the following code that loops through file names in a folder on my hard-drive, but I do not know how to take that path and open it with outlook.

Dim inPath as String
Dim thisFile as String
Dim msg as MailItem
Dim OlApp as Object
Set OlApp = CreateObject("Outlook.Application")
inPath = "C:\temp"

thisFile = Dir(inPath & "\*.msg")
Do While thisFile <> ""
    'At this point, thisFile contains the path of a .msg like "C:\temp\mail_item1.msg"
    'msg = <open mailitem> <~~~~ HELP HERE
    'Do stuff with msg

    thisFile = Dir
Loop

This question looked similar but was for C#, so I had some trouble getting the vba equivalent related to my problem. Maybe it will be obvious to someone more familiar with outlook vba.

niton

See here http://msdn.microsoft.com/en-us/library/office/ff865637.aspx

Sub CreateFromTemplate() 
 Dim MyItem As Outlook.MailItem 
 Set MyItem = Application.CreateItemFromTemplate("C:\statusrep.oft") 
 MyItem.Display 
End Sub 

Not just for .oft files

Set MyItem = Application.CreateItemFromTemplate("C:\temp\mail_item1.msg")

Edit - I keep forgetting about OpenSharedItem. http://msdn.microsoft.com/en-us/library/office/bb208171(v=office.12).aspx

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

读取Outlook .msg文件

来自分类Dev

如何查看Outlook .msg文件?

来自分类Dev

在Perl中阅读Outlook .msg

来自分类Dev

使用python解析Outlook .msg文件

来自分类Dev

Outlook VBA-Msg.SaveAs“路径”问题

来自分类Dev

在 AWS 上处理 Outlook .msg 消息

来自分类Dev

VSTO(Outlook)强制MSG附件为olEmbeddeditem类型,但需要olByValue

来自分类Dev

在Perl中阅读和文本匹配Outlook .msg文件

来自分类Dev

Outlook联系人信息作为vcard或.msg文件

来自分类Dev

从msg文件发送的Outlook约会不在日历中

来自分类Dev

Outlook MSG / OFT模板是动态生成还是静态生成的?

来自分类Dev

在C#应用程序中用Outlook显示.MSG文件?

来自分类Dev

如何从不在Outlook中的硬盘驱动器中打开Outlook .msg文件?

来自分类Dev

How do I open a VBA file in notepad or notepad++

来自分类Dev

从Access后期绑定到Open Outlook

来自分类Dev

从Access后期绑定到Open Outlook

来自分类Dev

How do I use my Application Resources from another window?

来自分类Dev

如何通过API将MSG / EML电子邮件文件导入Outlook?

来自分类Dev

通过Java或C#从Office 365 Outlook加载项创建.msg文件

来自分类Dev

从Outlook保存包含嵌入式图像的.msg,以供离线查看

来自分类Dev

pl / sql将带有附件的多封电子邮件转发为.msg文件(如Outlook)

来自分类Dev

Outlook 2010 VBA将消息另存为MSG将无法用作脚本

来自分类Dev

Python:有人知道msg Outlook文件的“已接收邮件日期”参数吗?

来自分类Dev

在 Outlook 2007 中查看 .msg 文件中的完整邮件标头

来自分类Dev

在具有完整功能的 Outlook 中打开外部 MSG 文件

来自分类Dev

如何使用 VBA 将本地 .msg 文件导入 Outlook 文件夹?

来自分类Dev

Modifying ActiveInlineResponseWordEditor from a Outlook 2007 add-in

来自分类Dev

Python:带有附件的Open Outlook Compose实例

来自分类Dev

How do I open up a random url from a list of url's in a new time each time it is clicked?

Related 相关文章

  1. 1

    读取Outlook .msg文件

  2. 2

    如何查看Outlook .msg文件?

  3. 3

    在Perl中阅读Outlook .msg

  4. 4

    使用python解析Outlook .msg文件

  5. 5

    Outlook VBA-Msg.SaveAs“路径”问题

  6. 6

    在 AWS 上处理 Outlook .msg 消息

  7. 7

    VSTO(Outlook)强制MSG附件为olEmbeddeditem类型,但需要olByValue

  8. 8

    在Perl中阅读和文本匹配Outlook .msg文件

  9. 9

    Outlook联系人信息作为vcard或.msg文件

  10. 10

    从msg文件发送的Outlook约会不在日历中

  11. 11

    Outlook MSG / OFT模板是动态生成还是静态生成的?

  12. 12

    在C#应用程序中用Outlook显示.MSG文件?

  13. 13

    如何从不在Outlook中的硬盘驱动器中打开Outlook .msg文件?

  14. 14

    How do I open a VBA file in notepad or notepad++

  15. 15

    从Access后期绑定到Open Outlook

  16. 16

    从Access后期绑定到Open Outlook

  17. 17

    How do I use my Application Resources from another window?

  18. 18

    如何通过API将MSG / EML电子邮件文件导入Outlook?

  19. 19

    通过Java或C#从Office 365 Outlook加载项创建.msg文件

  20. 20

    从Outlook保存包含嵌入式图像的.msg,以供离线查看

  21. 21

    pl / sql将带有附件的多封电子邮件转发为.msg文件(如Outlook)

  22. 22

    Outlook 2010 VBA将消息另存为MSG将无法用作脚本

  23. 23

    Python:有人知道msg Outlook文件的“已接收邮件日期”参数吗?

  24. 24

    在 Outlook 2007 中查看 .msg 文件中的完整邮件标头

  25. 25

    在具有完整功能的 Outlook 中打开外部 MSG 文件

  26. 26

    如何使用 VBA 将本地 .msg 文件导入 Outlook 文件夹?

  27. 27

    Modifying ActiveInlineResponseWordEditor from a Outlook 2007 add-in

  28. 28

    Python:带有附件的Open Outlook Compose实例

  29. 29

    How do I open up a random url from a list of url's in a new time each time it is clicked?

热门标签

归档