A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

NewMailEx event not Triggered



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old March 24th 10, 09:14 AM posted to microsoft.public.outlook.program_vba
savindrasingh
external usenet poster
 
Posts: 2
Default NewMailEx event not Triggered


Hello experts,

I am working on a macro to automate the processing of incoming mails
using below code:


Code:
--------------------
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim xlApp As New Excel.Application
Dim xlBook As New Excel.Workbook
Dim varEntryIDs, objItem
Dim i As Integer

Const OLECMDID_COPY = 12
Const OLECMDID_SELECTALL = 17
Const OLECMDEXECOPT_DODEFAULT = 0
Const OLECMDEXECOPT_PROMPTUSER = 1
Const OLECMDEXECOPT_DONTPROMPTUSER = 2
Const OLECMDEXECOPT_SHOWHELP = 3

Set ie = CreateObject("internetexplorer.application")

varEntryIDs = Split(EntryIDCollection, ",")
For i = 0 To UBound(varEntryIDs)
Set objItem = Application.Session.GetItemFromID(varEntryIDs(i))
If Left(objItem.Subject, 7) = "Action:" Then
ChDir ("C:\Temp")
TimeStamp = Format(Date, "dd-MM-yyyy") & Format(Time, "_HH_MM_SS")
OutFile = "Dss" & TimeStamp & ".html"
objItem.SaveAs "C:\Temp\" & OutFile, olHTML
url = "file:///C:/Temp/" & OutFile
Set xlBook = xlApp.Workbooks.Add(1)
With ie
.Top = 1
.Left = 1
.Height = 400
.Width = 500
.AddressBar = False
.MenuBar = False
.Toolbar = False
.Visible = True
.Navigate url
Do While .ReadyState 4
DoEvents
Loop

.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DONTPROMPTUSER
.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT
End With
xlApp.Visible = True
xlApp.Application.DisplayAlerts = False
xlBook.Activate
xlApp.ActiveSheet.Paste
xlApp.Range("1:5").EntireRow.Delete
xlApp.Range("1:1").EntireRow.Hidden = True
xlApp.Range(xlApp.Range("A1").End(xlDown).Offset(1 , 0).Row & ":" & xlApp.Range("A1").End(xlDown).Offset(1, 0).Row + 3).EntireRow.Hidden = True
xlApp.Cells.SpecialCells(xlCellTypeVisible).Column s.WrapText = False
xlApp.Cells.SpecialCells(xlCellTypeVisible).Column s.AutoFit
xlApp.Cells.EntireRow.Hidden = False
xlBook.SaveAs FileName:="C:\Temp\Dss" & TimeStamp & ".xls", FileFormat:=xlNormal
xlBook.Close
xlApp.Application.DisplayAlerts = True
xlApp.Quit
ie.Quit
Kill "C:\Temp\" & OutFile
Kill ("C:\Temp\Dss" & TimeStamp & "_files\*.*")
RmDir ("C:\Temp\Dss" & TimeStamp & "_files")
End If
Next
End Sub

--------------------


This code is working perfectly on my PC but the same code is not
working on my colleague's PC. The NewMailEx event is not getting
triggered.
Any ideas?


--
savindrasingh
http://forums.slipstick.com

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The EntryID in NewMailEx Event Al_21_11[_2_] Add-ins for Outlook 1 July 2nd 09 02:07 PM
Explorer.SelectionChange event triggered multiple times Dorian Add-ins for Outlook 9 September 18th 08 06:07 PM
Which event is triggered when user saves email item? Kasper Add-ins for Outlook 4 September 22nd 06 02:26 PM
How to fire NewMail&NewMailEx Event? baryon Outlook - General Queries 0 August 17th 06 04:31 PM
read event not triggered Willem Peper Outlook and VBA 1 June 13th 06 06:03 AM


All times are GMT +1. The time now is 03:43 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.