framednlv
07-07-2016, 12:38 PM
I need to make the last message sent active or highlighted in the sent mail folder. This is what I have so far:
Private Sub SentSave()
Dim objOL As Object 'As Outlook.Application
Dim objFolder As Object 'As Outlook.Folder
'get current folder
Set objOL = CreateObject("Outlook.Application")
Set objFolder = objOL.ActiveExplorer.CurrentFolder
Set objOL.ActiveExplorer.CurrentFolder = objFolder
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myOlApp.ActiveExplorer.CurrentFolder = myNamespace.GetDefaultFolder(olFolderSentMail)
Application.ActiveExplorer.ClearSelection
Application.ActiveExplorer.Activate
'<here I need to have the last item sent highlighted in the sentmail folder
'save emails to job folders using listbox
UserForm1.Show
'return to original folder
Set objOL.ActiveExplorer.CurrentFolder = objFolder
End Sub
Any help would be appreciated.
Chris
Private Sub SentSave()
Dim objOL As Object 'As Outlook.Application
Dim objFolder As Object 'As Outlook.Folder
'get current folder
Set objOL = CreateObject("Outlook.Application")
Set objFolder = objOL.ActiveExplorer.CurrentFolder
Set objOL.ActiveExplorer.CurrentFolder = objFolder
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myOlApp.ActiveExplorer.CurrentFolder = myNamespace.GetDefaultFolder(olFolderSentMail)
Application.ActiveExplorer.ClearSelection
Application.ActiveExplorer.Activate
'<here I need to have the last item sent highlighted in the sentmail folder
'save emails to job folders using listbox
UserForm1.Show
'return to original folder
Set objOL.ActiveExplorer.CurrentFolder = objFolder
End Sub
Any help would be appreciated.
Chris