您如何在 Outlook 2007 中 open/view .eml 文件(没有注册表编辑权限)?
How can you open/view .eml files in Outlook 2007 (no regedit permissions)?
对于我们这些在公司环境中无法控制使用哪个电子邮件客户端的人来说,suggested fix from Microsoft (and many other sources) 在 Outlook 2007 中打开 .eml 文件没有帮助,因为我们通常不会具有注册表访问权限,无法下载加载项。
埋没在无数沮丧的论坛用户帖子中的一个解决方案是使用具有以下结构的 "Run" 应用程序:
"[path to outlook]\Outlook.exe" /eml "[path to eml file]\[Filename].eml"
是否可以将其嵌入到可以从(例如)Outlook 本身访问的宏中?
当 运行 来自 Outlook 07 时,以下代码将起作用;它会提示输入 .eml 文件,然后使用问题中 "Run" 提示形式的 shell 命令打开它。不幸的是,由于 Microsoft 'unique' 支持 VBA 对象,因此无法从 Outlook 内部调用 FileDialog(msoFileDialogFilePicker)
。
因此,下面调用 Excel 的实例来处理对话框。 Application.Visible = True
行确保对话框位于最前面,因为它可以在当前应用程序后面打开,具体取决于 window 环境。
您可能需要编辑 C:\Program Files (x86)\Microsoft Office\Office12\Outlook.exe
以反映您的 Outlook 副本的安装位置。
Sub OpenEML()
' Macro to open EML type outlook files
Dim otherObject
Dim fDialog As Office.FileDialog
Set otherObject = CreateObject("Excel.Application")
Set fDialog = otherObject.Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.AllowMultiSelect = False
.ButtonName = "Open"
.Title = "Select an EML file"
'Allow only eml selection
.Filters.Add "EML", "*.eml", 1
otherObject.Application.Visible = True
.Show
otherObject.Application.Visible = False
'If some items are selected...
If .SelectedItems.Count <> 0 Then
fileNm = .SelectedItems(1)
Else
MsgBox "Nothing selected"
Exit Sub
End If
End With
Dim appNm As String
appNm = "C:\Program Files (x86)\Microsoft Office\Office12\Outlook.exe"
Dim retval
'MsgBox """" & appNm & """"
retval = Shell("""" & appNm & """" & " /eml " & """" & fileNm & """", vbNormalFocus)
End Sub
对于我们这些在公司环境中无法控制使用哪个电子邮件客户端的人来说,suggested fix from Microsoft (and many other sources) 在 Outlook 2007 中打开 .eml 文件没有帮助,因为我们通常不会具有注册表访问权限,无法下载加载项。
埋没在无数沮丧的论坛用户帖子中的一个解决方案是使用具有以下结构的 "Run" 应用程序:
"[path to outlook]\Outlook.exe" /eml "[path to eml file]\[Filename].eml"
是否可以将其嵌入到可以从(例如)Outlook 本身访问的宏中?
当 运行 来自 Outlook 07 时,以下代码将起作用;它会提示输入 .eml 文件,然后使用问题中 "Run" 提示形式的 shell 命令打开它。不幸的是,由于 Microsoft 'unique' 支持 VBA 对象,因此无法从 Outlook 内部调用 FileDialog(msoFileDialogFilePicker)
。
因此,下面调用 Excel 的实例来处理对话框。 Application.Visible = True
行确保对话框位于最前面,因为它可以在当前应用程序后面打开,具体取决于 window 环境。
您可能需要编辑 C:\Program Files (x86)\Microsoft Office\Office12\Outlook.exe
以反映您的 Outlook 副本的安装位置。
Sub OpenEML()
' Macro to open EML type outlook files
Dim otherObject
Dim fDialog As Office.FileDialog
Set otherObject = CreateObject("Excel.Application")
Set fDialog = otherObject.Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.AllowMultiSelect = False
.ButtonName = "Open"
.Title = "Select an EML file"
'Allow only eml selection
.Filters.Add "EML", "*.eml", 1
otherObject.Application.Visible = True
.Show
otherObject.Application.Visible = False
'If some items are selected...
If .SelectedItems.Count <> 0 Then
fileNm = .SelectedItems(1)
Else
MsgBox "Nothing selected"
Exit Sub
End If
End With
Dim appNm As String
appNm = "C:\Program Files (x86)\Microsoft Office\Office12\Outlook.exe"
Dim retval
'MsgBox """" & appNm & """"
retval = Shell("""" & appNm & """" & " /eml " & """" & fileNm & """", vbNormalFocus)
End Sub