+ Reply to Thread
Results 1 to 3 of 3

Outlook - Moving Old Mail to archive . OST error 440

  1. #1
    Registered User
    Join Date
    01-08-2020
    Location
    OH, US
    MS-Off Ver
    2016
    Posts
    1

    Outlook - Moving Old Mail to archive . OST error 440

    Good Morning Excel friends,
    Long time listener, First time caller.

    I'm really hoping someone here can help me out. I have a company policy where I work that retains email for 365 days and then deletes it. I have created some code through some VBA forums that will / should do the following:
    1. scan the specified subfolder that I want to move old messages
    2. look for emails that are old than 360 days
    3. once it finds an email older that 360 days, move it to another .ost called "archive"
    4. display a pop up that tells me how many messages have been moved.

    My current version of outlook is:
    Microsoft? Outlook? for Microsoft 365 MSO (Version 2202 Build 16.0.14931.21024) 64-bit
    Running windows 10

    Here is my code below:

    Please Login or Register  to view this content.


    My error is from this line:

    objVariant.Move objDestFolder

    The error is a runtime 440 error " cannot move the items"



    I really hope someone can help me out. Thank you in advance for taking a look and any help you can provide. Let me know if you need more information.
    I appreciate it,
    Humility36
    Attached Images Attached Images
    Last edited by 6StringJazzer; 07-17-2023 at 09:57 PM. Reason: inserted all the missing line breaks in the code

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Outlook - Moving Old Mail to archive . OST error 440

    This may take a while to unravel, and I may have to figure out how to test your code in my instance of Outlook to reproduce the error.

    If this code is running in Outlook, why are you using an Application object and setting it to the application? That's not necessary unless you are running the code from something other than Outlook. But I don't think that's causing your error.

    I would declare objVariant as Item but I don't think that's causing your error either.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Outlook - Moving Old Mail to archive . OST error 440

    I cannot run this code. GetFolderPath is not defined.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Run-time error '4605' for VBA excel to create mail in Outlook
    By fantasylo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-05-2021, 06:57 AM
  2. Help with moving data to an archive sheet
    By fish0321 in forum Excel General
    Replies: 3
    Last Post: 11-15-2020, 10:12 PM
  3. Download Outlook mail to excel - runtime error, array index out of bounds
    By Jarryd12 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-21-2017, 05:04 PM
  4. [SOLVED] Mail batch outlook run time error
    By Fean in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2016, 11:12 AM
  5. E-Mail Using Excel VBA & Outlook Error
    By NeedForExcel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-29-2014, 01:54 AM
  6. Moving an e-mail from a subfolder in Mailbox to the equivalent subfolder in an archive PST
    By johncassell in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2012, 11:31 AM
  7. [SOLVED] Moving a row to archive sheet
    By mmccra2858 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2012, 10:43 AM

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