Hi,
I am using the code below to open a userform when an email is added to the sent items folder in Outlook 2013
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Set Ns = Application.GetNamespace("MAPI")
'use the default folder
Set Items = Ns.GetDefaultFolder(olFolderSentMail).Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
UserForm3.Show
End Sub
This code works fine and opens the userform. On the userform there are several buttons that I want be apply to apply to the item that landed in the sent item folder causing the userform to be opened e.g. on of the buttons will delete the email, another will save the email in MSG format in a specific folder etc. The problem I am having is how to 'select' the email to apply the other macros to.
Any help would be appreciated as I'm new to coding and struggling with this one.
Thanks