totalfax.blogg.se

How to print multiple emails in outlook
How to print multiple emails in outlook






how to print multiple emails in outlook

This macro assumes the "move to folder" is a subfolder of the Inbox. In this example, I'm adding a new macro and calling it from the ItemAdd macro, after the PrintAttachments macro is called.Īt the end of the module, after the PrintAttachments macro, add the move macro. If you want to print the attachment then move the message to another folder, you'll either need to add the move code to the ItemAdd macro or add another macro and call it from the ItemAdd macro. ShellExecute 0, "print", sFile, vbNullString, vbNullString, 0 SFileType = LCase$(right$(oAtt.FileName, 4)) ' This code looks at the last 4 characters in a filename

how to print multiple emails in outlook

Private Sub PrintAttachments(oMail As Outlook.MailItem) Private Sub Items_ItemAdd(ByVal Item As Object) Set Folder = Ns.GetDefaultFolder(olFolderInbox) Set Ns = Application.GetNamespace("MAPI") Private WithEvents Items As Outlook.Items "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _īyVal lpFile As String, ByVal lpParameters As String, _īyVal lpDirectory As String, ByVal nShowCmd As Long) As Long Private Declare Function ShellExecute Lib "shell32.dll" Alias _ ' //' use Declare PtrSafe Function with 64-bit Outlook This starts the macro without the need to restart Outlook. Edit the code as needed then click in the Application_Startup() macro and press Run button (F8). To use, open the VBA editor using Alt+F11 and paste the following code into ThisOutlookSession. Original code was written for 32-bit Outlook and 3 character file extensions. Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias _ Print received attachments immediately code sample To use the macro with 64-bit Outlook, you need to add PtrSafe to Declare:

how to print multiple emails in outlook

The code looks at the last 4 characters, including the period and will work as long as you use 4 characters in each extension we want to check.Ĭase "xlsx", "docx", ".pdf", ".doc", ".xls"








How to print multiple emails in outlook