繁体   English   中英

引用收件箱的子文件夹

[英]Reference a sub-folder of the inbox

我发现以下 Outlook VBA 脚本可以批量打印子文件夹中的所有电子邮件附件:

Public Sub PrintAttachments()
Dim Inbox As MAPIFolder
Dim Item As MailItem
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer

Set Inbox = GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Parent.Folders.Item("Batch Prints")

For Each Item In Inbox.Items
    For Each Atmt In Item.Attachments
        ' all attachments are first saved in the temp folder C:\Temp.  Be sure to create this folder.
        FileName = "C:\Temp\" & Atmt.FileName
        Atmt.SaveAsFile FileName
        ' please change the program folder accordingly if the Acrobat Reader is not installed on drive C:
        Shell """C:\Program Files\Adobe\Reader 8.0\Reader\acrord32.exe"" /h /p """ + FileName + """", vbHide
    Next

    Item.Delete  'remove this line if you don't want the email to be deleted automatically
Next

Set Inbox = Nothing
End Sub

来源: http : //www.howtogeek.com/howto/microsoft-office/batch-print-pdf-attachments-in-outlook/

我的问题是:是否可以将此脚本转换为 64 位,因为安装 32 位 Office 不是一种选择。

我找到了 PtrSafe 但这似乎只与 .dll 声明相关。

办公版本:2016 64位

是的,如果您的文件夹是子文件夹,那么您将代码设置为

Set Inbox = GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Folders.("Batch Prints")

如果它是多个子文件夹,那么

Folders.("Folder name").Folders.("Batch Prints")

要在 64 位 Outlook 中使用该宏,您需要将PtrSafe添加到 Declare:

Office 2010 32 位和 64 位版本之间的兼容性

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM