+ Reply to Thread
Results 1 to 11 of 11

Excel/Outlook 2007 vba code doesn't work in Excel/Outlook 2010

  1. #1
    Registered User
    Join Date
    06-18-2014
    Location
    sydney
    MS-Off Ver
    2010
    Posts
    8

    Excel/Outlook 2007 vba code doesn't work in Excel/Outlook 2010

    Hi all,

    This is my first time posting and thanks in advance for your help! My company recently upgraded everyone to Microsoft 2010 from 2007 version. I have no substantial VBA skill and left with a VBA code which is supposed to extract a list of outlook emails sitting in a shared mailbox into Excel. I was using that VBA code in Outlook 2007 and it worked fine but shows the following error when run in Outlook 2010: 'Run-time error '-2147221233 (8004010f)': The attempted operation failed. An object could not be found. Here is part of the code:

    Please Login or Register  to view this content.
    The VB code failed at the Set olFolder part. Any suggestions would be greatly appreciated! Thanks again. - Evelyn
    Last edited by Leith Ross; 06-18-2014 at 07:38 PM. Reason: Added Code Tags

  2. #2
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Excel/Outlook 2007 vba code doesn't work in Excel/Outlook 2010

    Can you check if you still have "MailBox - Market" mailbox and a folder named Inbox in it, and a folder MI inside the Inbox folder? Or are these folder names changed as part of up gradation.

  3. #3
    Registered User
    Join Date
    06-18-2014
    Location
    sydney
    MS-Off Ver
    2010
    Posts
    8

    Re: Excel/Outlook 2007 vba code doesn't work in Excel/Outlook 2010

    Hi haripopuri,

    Thanks for your reply. I checked again and the mailbox is still named as "Market". I have tried removing the "Mailbox -" bit from the code (just to try it out) and I received the same error message as the one posted above.

  4. #4
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Excel/Outlook 2007 vba code doesn't work in Excel/Outlook 2010

    How about the other folder names viz. Inbox & MI?

  5. #5
    Registered User
    Join Date
    06-18-2014
    Location
    sydney
    MS-Off Ver
    2010
    Posts
    8

    Re: Excel/Outlook 2007 vba code doesn't work in Excel/Outlook 2010

    The inbox & MI folders are still there. Nothing has changed.

  6. #6
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Excel/Outlook 2007 vba code doesn't work in Excel/Outlook 2010

    Weird. Ok, lets do this. In your code window, click on any line of this code and press F8 repeatedly until the yellow focus moves to the error line, don't press F8 anymore. Now in immediate window, copy paste each of below lines, press enter after each line. Let us know where the error occur.
    ? olNS.Folders("Mailbox - Market").Folders.Count
    ? olNS.Folders("Mailbox - Market").Folders("Inbox").Items.Count
    ? olNS.Folders("Mailbox - Market").Folders("Inbox").Folders("MI").Items.Count

  7. #7
    Valued Forum Contributor Hawkeye16's Avatar
    Join Date
    02-27-2013
    Location
    Holland
    MS-Off Ver
    ├•┤ Pew Pew
    Posts
    441

    Re: Excel/Outlook 2007 vba code doesn't work in Excel/Outlook 2010

    If it helps at all I am on 2010 and this code works fine for me. The debugging that haripopuri suggested is probably your best bet of figuring out why it does not work.
    Despite the high cost of living, it remains very popular.

    Don't forget to mark threads SOLVED when you get an answer and rep all the geniouses that helped you today!

  8. #8
    Registered User
    Join Date
    06-18-2014
    Location
    sydney
    MS-Off Ver
    2010
    Posts
    8

    Re: Excel/Outlook 2007 vba code doesn't work in Excel/Outlook 2010

    Thanks guys for your help so far. I've tried and it showed error on the first line, Print olNS.Folders("Mailbox - Market Intelligence").Folders.Count with message saying "Method not valid without suitable object". My colleagues with Excel & Outlook 2010 seem to be able to run the code fine as well. I have also ticked Microsoft Excel & Outlook 14.0 Object Library etc on the Tools--> Reference.

  9. #9
    Registered User
    Join Date
    06-18-2014
    Location
    sydney
    MS-Off Ver
    2010
    Posts
    8

    Re: Excel/Outlook 2007 vba code doesn't work in Excel/Outlook 2010

    Hi guys, just want to update you that the macro works perfectly now!

    I tried running the macro a few times following haripopuri's suggestions and it didn't work. But when I opened the Visual Basic for Applications again, tested it with the same vb code and when I hit 'F5', it worked! Any idea as to why?

    However when I ran the macro straight from Excel sheet, it didn't work again. I closed the xls file and ran the macro again and it just works perfectly from then ont. Thanks for the help, guys! I really appreciate that.
    Last edited by eveloy; 06-18-2014 at 08:36 PM.

  10. #10
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Excel/Outlook 2007 vba code doesn't work in Excel/Outlook 2010

    Glad it worked. Mailbox name is Market Intelligence now, different from earlier name i.e. Markets.
    Print olNS.Folders("Mailbox - Market Intelligence").Folders.Count

  11. #11
    Registered User
    Join Date
    06-18-2014
    Location
    sydney
    MS-Off Ver
    2010
    Posts
    8

    Re: Excel/Outlook 2007 vba code doesn't work in Excel/Outlook 2010

    I tried running the macro this morning and it failed. It gave the same error message as the one posted on the first post. Any reason as to why this happened?

+ 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] VBA code to send excel attachment through outlook 2010
    By Liz_Biz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2014, 08:33 AM
  2. [SOLVED] VBA Macro to print to Pdf format and place as attachment in Outlook (Excel & Outlook 2007)
    By Webman1012 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-29-2013, 01:25 PM
  3. Macro from excel 2007 doesn't work in excel 2010
    By maddozs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-26-2013, 04:57 AM
  4. Replies: 2
    Last Post: 11-12-2012, 04:41 PM
  5. Share Task From Outlook 2010 to Outlook 2007 and Vice Versa
    By Hudas in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 10-22-2012, 03:01 PM

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