+ Reply to Thread
Results 1 to 15 of 15

Having trouble deleting email from inbox

  1. #1
    Registered User
    Join Date
    07-19-2011
    Location
    Ohio
    MS-Off Ver
    Excel 2003
    Posts
    9

    Having trouble deleting email from inbox

    I have the following code that saves any attachment to a folder.
    I am having trouble getting it to then delete the original email
    I tried using Item.Delete but it doesn't get them all
    Any help would be appreciated

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Having trouble deleting email from inbox

    Quote Originally Posted by rwilfing View Post
    I tried using Item.Delete but it doesn't get them all
    Did it work at all? I don't have Outlook installed at home but would have expected that to work.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    07-19-2011
    Location
    Ohio
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Having trouble deleting email from inbox

    Placing it before the "Next ATMT " line deleted all but the last 2 emails?


    So not sure if it is a matter of where I am placing it.

    I placed it After "Next Amnt" and it deleted up to an email with no attachment.

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Having trouble deleting email from inbox

    Do you want to delete all the emails or just ones with attachments?

    Dom

  5. #5
    Registered User
    Join Date
    07-19-2011
    Location
    Ohio
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Having trouble deleting email from inbox

    First .... Thank you for your responses


    All of them AFTER I have saved the attachments

  6. #6
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Having trouble deleting email from inbox

    I would expect this to work:

    Please Login or Register  to view this content.

    Dom

  7. #7
    Registered User
    Join Date
    07-19-2011
    Location
    Ohio
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Having trouble deleting email from inbox

    So would I have but it didn't delete them all.

    Left the last 2 there (not sure if the number it left is significant)

  8. #8
    Registered User
    Join Date
    07-19-2011
    Location
    Ohio
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Having trouble deleting email from inbox

    OK ran it several times and always left the last 2.
    With those 2 left as the only ones in my inbox....Ran it again and it deletes those 2??????

    hmmmmm

  9. #9
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Having trouble deleting email from inbox

    I have to admit I've got some similar code I wrote to strip attachments from my sent items to save space at work and it occasionally misses one. I've never really bothered to work out the reason why as it's few and far between.

    I'll have to test this tomorrow at work and see if I get a similar result.

    Dom

  10. #10
    Registered User
    Join Date
    07-19-2011
    Location
    Ohio
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Having trouble deleting email from inbox

    Seems to be random but happens every time I run it.


    Just put 3 mails in the box left only the last one this time.

    Not only does it not delete the mails but it doesn't save the attachment either.... Like the code decides there is the right place to stop

  11. #11
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Having trouble deleting email from inbox

    Isn't coding in Outlook fun

    Dom

  12. #12
    Registered User
    Join Date
    07-19-2011
    Location
    Ohio
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Having trouble deleting email from inbox

    First time trying it

    is a bit of a piecework code but it works great until I try to delete the mails

    Could I just add some code at the end of it to empty inbox?

  13. #13
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Having trouble deleting email from inbox

    Just doing a bit of research and it appears there can be some problems looping through a collection in Outlook like that. It seems that you are better looping through the items backwards.

    Again I will have to have a play tomorrow as unable to now.

    Dom

  14. #14
    Registered User
    Join Date
    07-19-2011
    Location
    Ohio
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Having trouble deleting email from inbox

    Appreciate it very much.

    I will check back tomorrow

  15. #15
    Registered User
    Join Date
    07-19-2011
    Location
    Ohio
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Having trouble deleting email from inbox

    Any Luck with this?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1