The other systems are having the same files at the same location.
On windows 7 it is running but no error is getting displayed but it is not updating the sheet also.
On windows XP, it is showing an error on the line "Function CheckText(CellToCheck As Range, KeyString As String) As Boolean" as some Type error.
I am attaching the script for reference.
VB Code:
Function CheckText(CellToCheck As Range, KeyString As String) As Boolean Dim CheckRange As Range, Hit As Range Set Hit = CellToCheck.Find(what:=KeyString, LookIn:=xlValues, Lookat:=xlWhole, MatchCase:=False) CheckText = Not (Hit Is Nothing) End Function Private Sub Application_NewMailEx(ByVal EntryIDCollection As String) Dim CheckRange As Range Dim KeyString As String vID = Split(EntryIDCollection, ",") Set XLApp1 = CreateObject("Excel.Application") Set CheckRange = XLApp1.Workbooks.Open("C:\Users\vijaywp\Desktop\India-IR-Schedule.xlsx").Sheets("Client Testing").Range("A1:S100") For i = 0 To UBound(vID) Set objMail = Application.Session.GetItemFromID(vID(i)) vSubject = objMail.Subject vBody = objMail.Body vFrom = objMail.SenderEmailAddress VRtime = objMail.SentOn KeyString = Mid(Trim(Mid(vSubject, InStr(vSubject, "#") + 1)), 1, 3) If CheckText(CheckRange, KeyString) = True Then Set XLApp = CreateObject("Excel.Application") Set xlWB = XLApp.Workbooks.Open("C:\Users\vijaywp\Desktop\sample.xlsx") Set xlSheet = xlWB.Sheets("Sheet1") vRow = xlSheet.Range("A" & XLApp.Rows.Count).End(-4162).Offset(1, 0).Row xlSheet.Range("A" & vRow).Value = vSubject xlSheet.Range("B" & vRow).Value = vBody xlSheet.Range("C" & vRow).Value = VRtime xlWB.Save XLApp.Quit Set objMail = Nothing Set XLApp = Nothing End If Next i XLApp1.DisplayAlerts = False XLApp1.Quit XLApp1.DisplayAlerts = True Set XLApp1 = Nothing End Sub
Please help me with this one.




Reply With Quote