我已经搜索了这个看似简单的任务的高低,但我遇到的所有引用都是保存到硬盘驱动器或从outlook文件夹中读取.
我有以下代码循环我的硬盘驱动器上的文件夹中的文件名,但我不知道如何采取该路径并使用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
Run Code Online (Sandbox Code Playgroud)
这个问题看起来很相似,但适用于C#,所以我在获取与我的问题相关的vba等效时遇到了一些麻烦.对于更熟悉outlook vba的人来说,这可能是显而易见的.