PDA

View Full Version : New Mail Alert



Zack Barresse
07-18-2005, 02:03 PM
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..
Beep


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.

Killian
07-19-2005, 01:10 AM
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 - :dunno sounds like it could be the work of an M$ security update but I've come across it before.

MOS MASTER
07-19-2005, 02:57 PM
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, :yes

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



Regarding the lack of access to the VBE - :dunno 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) :whistle:

MOS MASTER
07-19-2005, 03:09 PM
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. :yes

Zack Barresse
07-21-2005, 04:13 PM
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.. :dunno:

MOS MASTER
07-21-2005, 04:19 PM
Hi Zack, :yes

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):
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


I'll join you on your quest as soon as your Outlook is up for it! :whistle:

Zack Barresse
07-22-2005, 10:42 AM
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. :(

MOS MASTER
07-22-2005, 10:48 AM
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)

Zack Barresse
07-22-2005, 11:42 AM
Super Frustrating!!! It does absoutely nothing when I click on it. Keyboard shortcuts don't work .. nothing.

Scottie P
07-22-2005, 09:38 PM
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 :motz2: #$%&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 :rotlaugh: ] 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

MOS MASTER
07-23-2005, 02:35 AM
Hi Scott, :yes

Did Jake receive that code too??? :rofl: (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? :whistle:

Scottie P
07-23-2005, 09:57 AM
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! :devil:

MOS MASTER
07-23-2005, 02:47 PM
Hahaha...no that doesn't sound like a good idea! :rofl:

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

Btw..Zack what version of Outlook are you on?

Zack Barresse
07-24-2005, 04:25 PM
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. :)

Zack Barresse
07-25-2005, 10:34 AM
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!

MOS MASTER
07-25-2005, 10:38 AM
Yeah...that's great Zack! :yes

Now explain to me ... how where you able to disable that item? Explain in detail please! :motz2: :rofl: (love to know how)

Zack Barresse
07-26-2005, 01:08 PM
Now explain to me ... how where you able to disable that item? Explain in detail please! :motz2: :rofl: (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.

MOS MASTER
07-26-2005, 01:17 PM
Yes light burning over here as well. :yes

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) :banghead:

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

Later..:whistle: