【问题标题】:How can you open/view .eml files in Outlook 2007 (no regedit permissions)?如何在 Outlook 2007 中打开/查看 .eml 文件(无 regedit 权限)?
【发布时间】:2018-01-30 02:35:36
【问题描述】:

对于我们这些在企业环境中无法控制使用什么电子邮件客户端的人,Microsoft 的suggested fix(和manyothersources)在 Outlook 2007 中打开 .eml 文件时不会'没有帮助,因为我们通常没有注册表访问权限,也无法下载加载项。

隐藏在无数沮丧的论坛用户帖子中的一个解决方案是使用具有以下结构的“运行”应用程序:

"[path to outlook]\Outlook.exe" /eml "[path to eml file]\[Filename].eml"

是否可以将其嵌入到可以从(例如)Outlook 本身访问的宏中?

【问题讨论】:

    标签: vba email outlook outlook-2007


    【解决方案1】:

    从 Outlook 07 内部运行时,以下代码将起作用;它提示输入 .eml 文件,然后使用问题中的“运行”提示形式的 shell 命令打开它。不幸的是,由于 Microsoft 对 VBA 对象的“独特”支持,无法从 Outlook 内部调用FileDialog(msoFileDialogFilePicker)

    因此,下面调用了一个 Excel 实例来处理对话框。 Application.Visible = True 行确保对话框被带到前面,因为它可以根据窗口环境在当前应用程序后面打开。

    您可能需要编辑 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
    

    【讨论】:

      猜你喜欢
      • 2014-12-07
      • 2011-08-27
      • 1970-01-01
      • 1970-01-01
      • 2018-12-25
      • 2011-12-16
      • 2012-06-10
      • 1970-01-01
      • 2012-03-22
      相关资源
      最近更新 更多