+ Reply to Thread
Results 1 to 9 of 9

Check if a mailbox folder exists

  1. #1
    Registered User
    Join Date
    02-17-2009
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    21

    Check if a mailbox folder exists

    Hey Guys

    I have the following code which counts items in a mailbox:

    Please Login or Register  to view this content.
    I want to be able to run a check to see if the mailbox exists before I do an email count.

    So I need an IF statement to check if mailbox exists in destination, if yes then run email count and put in Cells(x,y) else if mailbox doesnt exist then put "N\A" in Cells(x,y).

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Check if a mailbox folder exists

    Why so complicated ?
    Please Login or Register  to view this content.
    Thsi code runs in Outllook. (not in Excel)

  3. #3
    Registered User
    Join Date
    02-17-2009
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: Check if a mailbox folder exists

    I need this to run in Excel...

    Its a scheduled report that I run everyday on about 10 mailboxes. Its counts all the items in each mailbox.

    If someone else runs it, i want it to show which mailboxes they dont have.

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Check if a mailbox folder exists

    From Excel

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-17-2009
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: Check if a mailbox folder exists

    Ummm This is not what I want. Thanks for your help though.

    For Each mailbox I need a count of all the items in the Inbox. These are then displayed in a particular cell that I assign it to. I have already done this. See the Code above.

    The only thing I am unable to do is:

    If the mailboxes is not available, in that desginated Cell in Excel I want it to display N\A, instead i am getting error messages.
    I know how to clear them, but instead I want it to display N\a in the cell.

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Check if a mailbox folder exists

    Try this:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  7. #7
    Registered User
    Join Date
    02-17-2009
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: Check if a mailbox folder exists

    Works Like a charm!

    Thanks

  8. #8
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Check if a mailbox folder exists

    Somewhat compacter
    Please Login or Register  to view this content.

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Check if a mailbox folder exists

    I'll take legible over compact any day...
    IIf is also slower than If..Then.

+ 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