mediocrerecord
New Member
- Outlook version
- Outlook 2016 64 bit
- Email Account
- Exchange Server
My question is a bit similar to this.
I receive emails daily about registrations from a certain email address. In this email there are 1-3 links.
The link text is "Download" and it refers to a link where the files are saved.
So if there is one attachment, it will say: some text: Download
For two it will say:
some text: Download
some text: Download
and for three:
some text: Download
some text: Download
some text: Download
What I am looking for as a vba macro is to be able to select these emails and then run the macro. The macro should print each email and then go to the link and print the attachments in these links one by one for all emails selected.
The order should be print email, print link 1 attachment, print link 2 attachment (if present), print link 3 attachment (if present), print second email, print second email attachments and so on.
I am looking for a vba solution as I won't have right to install anything else on the computer.
Appreciate your help.
I must mention here that I am completely new to outlook-vba and below has been generated by copy/paste/edit from here. It is working to print the emails. I now need help with printing the attachments by following the hyperlinks in the email. I have also come across this when doing more research, but it is all Greek to me.
Below is the code used to print the email.
I receive emails daily about registrations from a certain email address. In this email there are 1-3 links.
The link text is "Download" and it refers to a link where the files are saved.
So if there is one attachment, it will say: some text: Download
For two it will say:
some text: Download
some text: Download
and for three:
some text: Download
some text: Download
some text: Download
What I am looking for as a vba macro is to be able to select these emails and then run the macro. The macro should print each email and then go to the link and print the attachments in these links one by one for all emails selected.
The order should be print email, print link 1 attachment, print link 2 attachment (if present), print link 3 attachment (if present), print second email, print second email attachments and so on.
I am looking for a vba solution as I won't have right to install anything else on the computer.
Appreciate your help.
I must mention here that I am completely new to outlook-vba and below has been generated by copy/paste/edit from here. It is working to print the emails. I now need help with printing the attachments by following the hyperlinks in the email. I have also come across this when doing more research, but it is all Greek to me.
Below is the code used to print the email.
Code:
Option Explicit
Public Sub PrintDelete()
Dim objOL As Outlook.Application
Dim objMsg As Outlook.MailItem
Dim objAttachments As Outlook.Attachments
Dim objSelection As Outlook.Selection
Dim i As Long
Dim lngCount As Long
Dim Response As Integer
Dim msg As String
Dim strSubject As String
' Instantiate an Outlook Application object.
Set objOL = CreateObject("Outlook.Application")
' Get the collection of selected objects.
Set objSelection = objOL.ActiveExplorer.Selection
' Check selected item for attachments.
For i = objSelection.Count To 1 Step -1
objSelection(i).PrintOut
Call LaunchURL(objSelection(i).objMsg)
Next
ExitSub:
Set objAttachments = Nothing
Set objMsg = Nothing
Set objSelection = Nothing
Set objOL = Nothing
End Sub