+ Reply to Thread
Results 1 to 10 of 10

Run time error 424: Object Required in Outlook/Excel VBA

  1. #1
    Registered User
    Join Date
    06-25-2013
    Location
    Jacksonville, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Run time error 424: Object Required in Outlook/Excel VBA

    I had this code working and after I put code in to automatically save the workbook on close I am getting this error.

    This is the structure. I am autoprocessing emails I receive using a rule in outlook. The rule searches for new mail with a certain subject, moves it to a new folder, and runs a macro in outlook to copy the data from the email body to an excel file. The Excel file has an auto_open macro that appends the new data from each email to an access database, moves the data then to a new sheet, saves the workbook, and closes the file.

    So when Outlook is processing the email it stops on this line:

    Please Login or Register  to view this content.


    Full code:

    Outlook

    Please Login or Register  to view this content.



    Excel code in workbook:

    Please Login or Register  to view this content.

    Excel Code in module:

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Have you checked the workbook is actually being opened?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    06-25-2013
    Location
    Jacksonville, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Run time error 424: Object Required in Outlook/Excel VBA

    I haven't changed anything location or name wise with the excel file - just the macro within it. How would I isolate that?

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run time error 424: Object Required in Outlook/Excel VBA

    So the only change in the code is the addition of this line?
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-25-2013
    Location
    Jacksonville, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Run time error 424: Object Required in Outlook/Excel VBA

    No I'm pretty sure it was the last block of the excel code...

    Please Login or Register  to view this content.
    So the creation of the second sheet "archived" and that code I believe.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    I'm a little confused.

    Are you getting the error in the code in Outlook and it's only started appearing after you changed the code in Excel?

  7. #7
    Registered User
    Join Date
    06-25-2013
    Location
    Jacksonville, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Run time error 424: Object Required in Outlook/Excel VBA

    Yes that's correct

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run time error 424: Object Required in Outlook/Excel VBA

    I think I see what the problem is.

    When you open the workbook xlWB the macro Export is immediately executed.

    Right at the end of the code in that macro you have this which closes the workbook.
    Please Login or Register  to view this content.
    So when code execution returns to the Outlook sub xlWB is closed.

    I'm not sure how to resolve the problem properly, you could just remove the above code, but I think you might need to have a rethink on the order the code is being executed.

    By the way, couldn't you put the data directly into Access (and Excel if it's required) using code located in Outlook.

  9. #9
    Registered User
    Join Date
    06-25-2013
    Location
    Jacksonville, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Run time error 424: Object Required in Outlook/Excel VBA

    Ah good suggestion - I will edit it with that in mind and see if it works. It definitely makes sense.

    And yes, I believe you're right as well with doing it all from outlook and I may consolidate at the end here and try. I'm just running against a tight deadline and was trying to get it working before making it as efficient as possible.

    I really appreciate your help and will let you know once I try this!

  10. #10
    Registered User
    Join Date
    06-25-2013
    Location
    Jacksonville, FL
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Run time error 424: Object Required in Outlook/Excel VBA

    Alright so it all works - you were exactly right!! I took out the two lines:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

    And put them into the outlook vba before the xlWB close and I was off and running! I can't thank you enough for your help and second set of eyes on this. Now that it is all working and I have a little more time still and have fulfilled my self Proof of Concept I will incorporate the excel code into outlook and just run it all from there.

    Thanks again!

+ 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. [SOLVED] Simple Calendar pop up macro --> error Run-time error '424': Object required
    By am_hawk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2013, 10:38 AM
  2. VBA - “Run-time error 424: object required”
    By randiba in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-23-2013, 07:28 AM
  3. Excel 2010 VBA unprotect password - run time error 424 Object required
    By wov in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-24-2012, 01:35 AM
  4. Excel 2007 Beta 2 - Macro Run-time error '424' Object required
    By jcm21 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-16-2006, 02:20 PM
  5. Run-Time Error 424 - Object Required
    By SpottyTash in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2005, 09:05 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