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
 
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
>
 
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
 
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
B Inconsistent handling of message read/unread status by Outlook Using Outlook 3
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
J Outlook 2021 ScanPST errors (yet again ... sorry): repair button missing Outlook 2021 Using Outlook 5
J SCANPST errors Outlook PST repair? Using Outlook 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
H using VBA to edit subject line Outlook VBA and Custom Forms 0
e_a_g_l_e_p_i Need clarification on 2-Step Verification for Gmail using Outlook 2021 Using Outlook 10
e_a_g_l_e_p_i Outlook 2021 not letting me setup my Gmail using pop Using Outlook 1
Geldner Problem submitting SPAM using Outlook VBA Form Outlook VBA and Custom Forms 2
O How to find out the domain and server settings that my Outlook is using? Using Outlook 2
S Outlook 2019 Custom outlook Add-in using Visual Studio Outlook VBA and Custom Forms 0
D Outlook 2021 Using vba code to delete all my spamfolders not only the default one. Outlook VBA and Custom Forms 0
M using excel to sort outlook appointment items Outlook VBA and Custom Forms 4
R Advise on using multiple instances of network files based on customers Outlook VBA and Custom Forms 8
HarvMan Using Emojis in Outlook 365 Using Outlook 3
T Outlook 2019 Not Using Auto Compete After Deletion of 365 Using Outlook 1
M USING INITIALS AS RECIPIENTS Using Outlook 1
T Outlook 2019 Using Gmail aliases in Outlook Using Outlook 6

Similar threads

Back
Top