I have a module with a public variable set like so:
Public Myfolder as Outlook.MAPIFolder
When I try to clear it out after looping through my array and finding a match it doesn't clear
For aa = LBound(aEmails) To UBound(aEmails)
On Error Resume Next
pos1 = Application.WorksheetFunction.Find(aEmails(aa, cName), sEmail)
If Err <> 0 Then
'insert code here to move items with no box found to a generic box.
'Set oFolder = Application.GetNamespace("MAPI")
'Set MyFolder = oFolder.Folders("Generic")
'oMail.Move MyFolder
Err = 0
Else
Set oFolder = Application.GetNamespace("MAPI")
Set Myfolder = oFolder.Folders(aEmails(aa, cFoldr))
oMail.Move Myfolder
Sheets("Report").Select
Do Until ActiveCell = ""
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell = sFromName
ActiveCell.Offset(0, 1) = sSubject
ActiveCell.Offset(0, 2) = aEmails(aa, cName)
ActiveCell.Offset(0, 3) = aEmails(aa, cFoldr)
ActiveCell.Offset(0, 4) = Now
ActiveCell.Select
Set oFolder = Empty
Set Myfolder = Empty
GoTo Endloop:
End If
'On Error GoTo 0
Set oFolder = Empty
Set Myfolder = Empty
Next aa
Endloop:
I am coming up blank. Any help would be appreciated!
Bookmarks