Hi,
I'm trying to create a button to send to the clipboard the dates and subjects of all the emails in the current folder but I can't get them sorted by subject! I'm using the 'Sort' method but doesn't seem to work at all (doesn't generate an error but doesn't sort my items neither).
Any idea of what I'm doing wrong? Here's the code if you wanna take a look. THANKS!
Dim app As Outlook.Application
Dim nameSpace As nameSpace
Dim currentFolder As MAPIFolder
Dim st As String
Set app = CreateObject("Outlook.Application"
Set nameSpace = app.GetNamespace("MAPI"
Set currentFolder = app.ActiveExplorer.currentFolder
Set myItems = app.ActiveExplorer.currentFolder.Items
' currentFolder.Items.IncludeRecurrences = True
myItems = myItems.Sort("[Subject]"
For k = 1 To currentFolder.Items.Count
st = st & "Sent: " & currentFolder.Items(k).SentOn & _
" Subject: " & currentFolder.Items(k).Subject & " " & vbNewLine
Next
ClipBoard_SetData (st)
I'm trying to create a button to send to the clipboard the dates and subjects of all the emails in the current folder but I can't get them sorted by subject! I'm using the 'Sort' method but doesn't seem to work at all (doesn't generate an error but doesn't sort my items neither).
Any idea of what I'm doing wrong? Here's the code if you wanna take a look. THANKS!
Dim app As Outlook.Application
Dim nameSpace As nameSpace
Dim currentFolder As MAPIFolder
Dim st As String
Set app = CreateObject("Outlook.Application"
Set nameSpace = app.GetNamespace("MAPI"
Set currentFolder = app.ActiveExplorer.currentFolder
Set myItems = app.ActiveExplorer.currentFolder.Items
' currentFolder.Items.IncludeRecurrences = True
myItems = myItems.Sort("[Subject]"
For k = 1 To currentFolder.Items.Count
st = st & "Sent: " & currentFolder.Items(k).SentOn & _
" Subject: " & currentFolder.Items(k).Subject & " " & vbNewLine
Next
ClipBoard_SetData (st)