This, however, results in a "type mismatch" error. I tried using the string "Trash" for the folder name instead of calling the entire routine. Gmail uses the folder Trash for deleted messages. Outlook is accessing, via IMAP, my Gmail account. There is only one e-mail account within Outlook. MsgBox "Nothing to delete.", vbOKOnly, "Empty Folder " & sFolder "Do you want to delete these messages now?", vbYesNo, "Empty the " & sFolder & " Folder") VbAnswer = MsgBox("There are " & CStr(iTotalItems) & " messages in the " & sFolder & " Folder." & vbCrLf & _ If Not (olFindFolder Is Nothing) Then Exit For Set olFindFolder = olFindFolder(olSubFolder.Folders, sFolderName) If LCase(olSubFolder.Name) Like LCase(sFolderName) Then Set = olNS.GetDefaultFolder(olFolderInbox)įunction olFindFolder(olFolders As Outlook.Folders, sFolderName As String) As Folder Set olNS = Application.GetNamespace("MAPI") The line where the "Error 91" occurs when run actively is bolded in the code below. Since the error does not occur in Debug Mode (step into), I am at a However, when the macro/code is run actively when exiting Outlook an "Error 91" occurs. The VBA code below will successfully complete when run via the debugger in the VBA project window.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |