Hi Guy's hope you are all well
If this is something fairly simple, i wouldn't mind adding a command button or 2 command buttons (< and >) to go to the previous/next email that a search is already is active when there is more than 1 email for that email address (CurrentItem.Body) From CurrentItem.Sender
I guess I am asking is it possible to select last or next email body from the CurrentItem.Sender and add CurrentItem.Body to Me.txtMailMessage via a Left/right button (Last button "<" Or Next Button ">")
I have not pasted all of my code here as there is lots of it, i think i have picked out my Dim's
Hope this makes sense
Code:
Dim ol As Outlook.Application
Dim Explorer As Outlook.Explorer
Dim CurrentItem As Outlook.MailItem
Dim Sender As Outlook.AddressEntry
Dim Contact As Outlook.ContactItem
Dim InAccount As Outlook.Account, app As Object
Set ol = CreateObject("Outlook.Application")
Set Explorer = ol.ActiveExplorer
Dim strMailSearch as String
If Explorer.Selection.Count Then
Set CurrentItem = Explorer.Selection(1)
If CurrentItem.Class = olMail Then
Set Sender = CurrentItem.Sender
If Sender Is Nothing Then
MsgBox "There is no sender for current email", vbInformation
Else
Me.txtEmailAddress = CurrentItem.SenderEmailAddress
Me.txtName = CurrentItem.Sender
Me.txtMobileNo = ""
Me.txtContactNo = ""
Me.txtMailMessage = CurrentItem.Body
Me.txtSubject = CurrentItem.Subject
strMailSearch = Me.txtEmailAddress
Set app = GetObject(, "Outlook.Application")
On Error GoTo 0
If app Is Nothing Then
Set app = CreateObject("Outlook.Application")
app.Explorers.Add app.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
app.Explorers(1).Activate
End If
app.ActiveExplorer.Search strMailSearch, olSearchScopeAllFolders
End IF
End IF
End IF