Consulting

Results 1 to 18 of 18

Thread: New Mail Alert

  1. #1
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location

    New Mail Alert

    Okay, so I know how to make something happen when new mail arrives. What I'm looking to do is have one alert if any new mail has arrived during the current/last Send/Receive. The way I have it now using the NewMail event, my routine will run everytime a new mail is received. So if I hit my Send/Receive button and I have 10 new messages come in, the routine will run 10 times! I only want it to run once.

    What I'm having run is somewhat irrelevant. Right now I only have in there..
    [vba]Beep[/vba]


    In a related subject, I can no longer test this at my work pc, because I can't access Outlook's VBE anymore. Any ideas as to why?? It's driving me batty.. Can't bring up my Security dialog box, my Macro dialog box or the VBE. Nothing else seems to be out-of-whack. This is running on an Exchange Server.

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Hiya Zack,
    The NewMailEx event is what you're looking for... it passes a comma delimited list of entry IDs of all the items received in the Inbox since the last time the event was fired.

    Regarding the lack of access to the VBE - sounds like it could be the work of an M$ security update but I've come across it before.
    K :-)

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Quote Originally Posted by Killian
    Hiya Zack,
    The NewMailEx event is what you're looking for... it passes a comma delimited list of entry IDs of all the items received in the Inbox since the last time the event was fired.
    Hi K & Zack,

    Good advice Killian!
    btw Zack there's an excellent example of this application event in the Help of outlook to help you.

    Quote Originally Posted by Killian
    Regarding the lack of access to the VBE - sounds like it could be the work of an M$ security update but I've come across it before.
    Hmmzzz...this is strange. This is the third time I heard about this problem today.
    Fumei told me he had a pc virus and after that none of his VBE/macro thingies are working anymore...

    This could be a new virus otherwise I wouldn't know..

    Perhaps it could also be a missing OTM file but that doesn't make sence....(will start a search later)
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    More questions Zack.

    Some guesses...:

    Does this problem occur in All Office apps? or only in Outlook?
    And have you checked with sys admin?

    Perhaps there is some group policy action in the active directory I don't know of that you can switch of all Macro stuff in Office? (Would make sense in a working environment but don't know of any)

    If there is I'm very curious to exactly what settings they are and how to test that.
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  5. #5
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Nope, just Outlook. I'm going to test if it's maybe a third party app, possibly NAV. I'll post those results when they come in.

    Hmm, I'll have to check out the NewMailEx event.. well, as seing how I can't on this computer (no VBE access.. ) when exactly does this event fire? When all mail is done downloading? Or When mail is starting to get downloaded? I didn't remember seeing it in the drop down of events in the VBE.. :

  6. #6
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Hi Zack,

    I couldn't find anything on the subject so for now I'm in the dark like you!

    To the NewMailEx application Event:

    This occors when a new mail (or mails) is received in your Inbox that's why it can handle more then one mail at the time. (The amount of processed ID's is bound to the RAM on your pc so this shouldn't cause a problem!)

    But you should just paste NewMailEx in the VBE and press F1 to get the full story.

    This is the example from Outlook help (2003):[vba]
    Public WithEvents outApp As Outlook.Application

    Sub Intialize_Handler()
    Set outApp = Application
    End Sub

    Private Sub outApp_NewMailEx(ByVal EntryIDCollection As String)
    Dim mai As Object
    Dim intInitial As Integer
    Dim intFinal As Integer
    Dim strEntryId As String
    Dim intLength As Integer

    intInitial = 1
    intLength = Len(EntryIDCollection)
    MsgBox "Collection of EntryIds: " & EntryIDCollection
    intFinal = InStr(intInitial, EntryIDCollection, ",")
    Do While intFinal <> 0
    strEntryId = Strings.Mid(EntryIDCollection, intInitial, (intFinal - intInitial))
    MsgBox "EntryId: " & strEntryId
    Set mai = Application.Session.GetItemFromID(strEntryId)
    MsgBox mai.Subject
    intInitial = intFinal + 1
    intFinal = InStr(intInitial, EntryIDCollection, ",")
    Loop
    strEntryId = Strings.Mid(EntryIDCollection, intInitial, (intLength - intInitial) + 1)
    MsgBox strEntryId
    Set mai = Application.Session.GetItemFromID(strEntryId)
    MsgBox mai.Subject

    End Sub
    [/vba]


    I'll join you on your quest as soon as your Outlook is up for it!
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  7. #7
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Well, no luck with the VBE, or the Security window, or the Macros dialog box. None of it comes up anymore. I'm just going to have to wait until I get at the wife's pc. And I did try a detect and repair to no avail.

  8. #8
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Quote Originally Posted by firefytr
    Well, no luck with the VBE, or the Security window, or the Macros dialog box. None of it comes up anymore. I'm just going to have to wait until I get at the wife's pc. And I did try a detect and repair to no avail.
    o Boy...must be frustrating....I wil do some more searching later. (have no idea)
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  9. #9
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Super Frustrating!!! It does absoutely nothing when I click on it. Keyboard shortcuts don't work .. nothing.

  10. #10
    Just A Dude VBAX Tutor Scottie P's Avatar
    Joined
    May 2004
    Location
    Remote from 18901 USA
    Posts
    263
    Location
    Just an FYI:
    I know this is a real frustrating thing and had it happen also - but on XP Pro. I am not familiar with X-Server at all - are it and XP genetically linked??

    I ran into the problem using Outlook XP Pro early last year [Zack you may even remember this, I don't know]. Suat had just sent some really cool codes over and I was super anxious to try some of it out. Nothing worked after the first run...then I found that I couldn't open the VBE...it was as if that whole part of the Outlook application was never there, but I did have the VBA toolbar - just nothing behind the buttons.
    I was so #$%&ed with it all that I ended up wiping my machine and reverting to Outlook 2000 SP2 - which I am still using; I have not encountered the problem again and everything has run flawless [unless I coded it, of course ] ever since.
    I know this won't solve your problem, but wanted to put it out there since this thread seems to have leaned toward the missing VBE point.

    Scott
    Life is Visual: Presence is Perception...
    How we see the world is how we respond to it. ~* Peace *~

  11. #11
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Hi Scott,

    Did Jake receive that code too??? (knowing he doesn't program that much in Outlook)

    No serious..do you still have that code? Can you send it to me or post it?
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  12. #12
    Just A Dude VBAX Tutor Scottie P's Avatar
    Joined
    May 2004
    Location
    Remote from 18901 USA
    Posts
    263
    Location
    I am sure that I still have it. There were two different sets, actually so I will send each. One of them I have already found (tucked away since last year) and will be sending soon. The other I will have to find - I know it is here [either buried on the HD or on a backup CD], I just need to find it.

    One thing I can add is that Dreamboat has used the one - which I still have not found - with no such trouble and her machine was also XP Windows / XP Office Pro. I am convinced that the problem was the sort that the conditions of the PC set up and the code just didn't work well together at the time it was run. Also, I had made minor changes to my version that have since run well with Outlook 2000...just not with Outlook XP Pro.

    Scott

    PS - No...I didn't send that one to him but it sounds like a good idea!
    Life is Visual: Presence is Perception...
    How we see the world is how we respond to it. ~* Peace *~

  13. #13
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Hahaha...no that doesn't sound like a good idea!

    I'm curious perhaps that code could shet some light on this situation.

    Btw..Zack what version of Outlook are you on?
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  14. #14
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Home: Outlook XP HE
    Work: Outlook 2003 Pro

    The one thing I need to check at work (the Outlook that isn't working) is the Disabled Items from the Help | About menu. Forgot to check that one.. Did I mention a Detect and Repair did nothing?

    VBE still works on the wife's home pc. Going to try your code. I'll let you know how it works.

  15. #15
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Quickly tried the NewMailEx on the wife's pc, couldn't get it to work. Didn't fiddle with it too much though, was very busy.

    Btw, I DID have a disabled item in my work pc Outlook! My Outlook VBA! All is working well now! LOL!

  16. #16
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Yeah...that's great Zack!

    Now explain to me ... how where you able to disable that item? Explain in detail please! (love to know how)
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  17. #17
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Quote Originally Posted by MOS MASTER
    Now explain to me ... how where you able to disable that item? Explain in detail please! (love to know how)
    I don't know. It only says that the Disabled Items is a list of items that prevented Outlook from functioning properly (and thus disabled). So somewhere along the way I did a no-no in Outlook or gave it a burp it didn't like and it disabled my OL VBA.

  18. #18
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Yes light burning over here as well.

    I finaly know what you mean.

    You mean in Help menu press Info and then disabled items...(Ah stupid me...you did so buth I read over it)

    I have a com add-in which causes the same problem if I over do it with programming and then I have to reset it at disabled items and VBA.dll as well over there....(Why didn't I think of that)

    Well now you no where to find it in the future and I have a refresh as well.

    Later..
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

Posting Permissions

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