HANDLING ERRORS USING FIND

  • Thread starter chuck.grob@invesco.com
  • Start date
Status
Not open for further replies.
C

chuck.grob@invesco.com

The code below is what I am using to handle a very unusual situation

(VBA code cannot find an email with 'specific email Subject' as the

Subject).

Is there a better way to do this?

Set olMi = Fldr.Items.Find("[Subject] = 'specific email Subject")

If Not TypeName(olMi) = "Nothing" Then

olMi.Delete

End If

Thanks for your input,

JingleRock
 
S

Sue Mosher [MVP]

I'd use something more like this:

On Error Resume Next

Set olMi = Fldr.Items.Find("[Subject] = 'specific email Subject")

If olMi Is Nothing Then

olMi.Delete

End If

Sue Mosher

<chuck.grob@invesco.com> wrote in message

news:801888e3-d5f6-4e55-96d4-2a1f13274593@w9g2000yqa.googlegroups.com...
> The code below is what I am using to handle a very unusual situation
> (VBA code cannot find an email with 'specific email Subject' as the
> Subject).

> Is there a better way to do this?

> Set olMi = Fldr.Items.Find("[Subject] = 'specific email Subject")

> If Not TypeName(olMi) = "Nothing" Then
> olMi.Delete
> End If

> Thanks for your input,
> JingleRock
>
 
C

chuck.grob@invesco.com

Thanks Sue,

I think you meant:

I'd use something more like this:

If Not olMi Is Nothing Then

olMi.Delete

End If

If code finds email (it almost always will), then it will be deleted.

JingleRock
 
S

Sue Mosher [MVP]

Yes, that pesky Not definitely needs to be there! Good catch.

Sue Mosher

<chuck.grob@invesco.com> wrote in message

news:2553f5a9-39cc-422a-aa2d-9f951c948caf@e18g2000yqo.googlegroups.com...
> Thanks Sue,

> I think you meant:

> I'd use something more like this:

> If Not olMi Is Nothing Then
> olMi.Delete
> End If

> If code finds email (it almost always will), then it will be deleted.

> JingleRock

>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
A How are you handling Outlook.com category issue and syncing Using Outlook.com accounts in Outlook 2
Stig Arvidsson Need a Script for handling moved mail from inbox Using Outlook 3
S Need solution to Outlook mail handling/syncing/mobile situation, please Using Outlook 2
P Handling Multiple eMail Accounts Using Outlook 2
K Handling application.quit event Outlook VBA and Custom Forms 8
S Need: Date handling in Outlook Macros, either information/documentation Outlook VBA and Custom Forms 1
T Outlook 2003 Custom Form Error Handling Outlook VBA and Custom Forms 8
U Adding multiple menu Items. Problems handling the click events Outlook VBA and Custom Forms 1
pcunite Outlook 2019/O365 Build 13127.20408 errors when using MAPI calls Using Outlook 1
B Server errors Outlook 2007 Using Outlook 1
P errors appear every time I run SCANPST Using Outlook 3
A ScanPST finding errors but no Repair button Using Outlook 2
Y IMAP errors with Outlook 2016 Using Outlook 2
M Charter ISP Claims Outlook Generating STMP Errors of Too Many Recipients Using Outlook 1
Diane Poremsky BCM Errors after Upgrading to Windows 10 Using Outlook 1
Diane Poremsky Common Outlook Outgoing Server (SMTP) Errors Using Outlook 0
M attachments & time-out errors Using Outlook 4
L Issues with Outlook - errors detected in file Using Outlook 1
P 2013 AOL IMAP Sync Errors Using Outlook 5
E Multiple, intermittent Outlook 2010 errors Using Outlook 12
icacream errors have been detected... outlook.pst Using Outlook 10
J No errors from BCM 2007 but can't see database BCM (Business Contact Manager) 0
M The set of folders cannot be opened. Errors have been detected in the file. Using Outlook 11
A PDF Attachement Errors with Outlook 2010 Using Outlook 7
D VBA Macro Works in 2007 but errors in 2010 Using Outlook 2
J OL2003 Public Folder Sync Errors w/ Exchange 2010 Exchange Server Administration 11
V What is wrong with Outlook Connector - it still errors out on an EMPTY Hotmail Using Outlook.com accounts in Outlook 3
M Outllook 2000 - 2 Errors - The Information Service / The Messaging Interface Using Outlook 7
P IMAP errors with AOL during sync Outlook VBA and Custom Forms 3
B Import to Access errors out Outlook VBA and Custom Forms 20
T field mapping errors during import BCM (Business Contact Manager) 1
D BCM 2007 errors BCM (Business Contact Manager) 5
L Out of memory errors and Auto-linking hangs BCM (Business Contact Manager) 2
R Errors while adding new item to main menu Outlook VBA and Custom Forms 4
P Prevent Outlook 2016 from using DASL filter Using Outlook 4
O Calendar - Location: what happens when using my own way of entering locations Using Outlook 1
M Disable Contact Card Results when using "Search People" in Outlook Ribbon Using Outlook 7
K can't get custom form to update multiple contacts using VBA Outlook VBA and Custom Forms 3
S Outlook VBA How to adapt this code for using in a different Mail Inbox Outlook VBA and Custom Forms 0
B Change Font and Font size using VBA Outlook VBA and Custom Forms 9
M Outlook 2013 reminder email by using Outlook vba Outlook VBA and Custom Forms 2
X Using Outlook 2013 and Outlook 365 Using Outlook 1
A Going to folder using shortcuts Using Outlook 3
A Outlook replies not using "delivered to" address in From Using Outlook 1
Terry Sullivan E-Mails Sent Using a Group Box Result in 70 Kickbacks Using Outlook 5
O Email not leaving Outbox when using Excel VBA to sync Outlook account Outlook VBA and Custom Forms 4
K Using Outlook 2016 to draw Using Outlook 1
O Outlook 365 - suddenly unable to send using Gmail POP3 Using Outlook 10
N Disable Auto Read Receipts sent after using Advanced Find Using Outlook 4
G Outlook 2016 sync contacts directly between phone and computer using outlook 2016 Using Outlook 0

Similar threads

Top