Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming,microsoft.public.outlook.program_vba
|
|||
|
|||
trying to search excel from Outlook... NO Results
I am trying to find a phone number that is located in an excel spreadsheet. The phone number is the last 10 digets in the subject of an email. The phone should be found in workbook "Current" and the worksheet "Master" The format of the phone is 1-(xxx) xxx-xxxx in the excel spreadsheet, so it should be being found, but it is not... I am calling this from a script being ran by RULES in outlook when a given string is found. That part is working, but I can not getting anything after the MsgBox "Mail message arrived: " & phn If I move the above line in to the if found (even in the else!) I get nothing... TIA, Phil ------------------------- Sub Phonetest(Item As Outlook.MailItem) Dim phn As String, phn1 As String, phn2 As String, phn3 As String, phn4 As String Dim xlApp As Excel.Application phn1 = Right(Item.Subject, 10) phn2 = Left(phn1, 3) phn3 = Mid(phn1, 4, 3) phn4 = Right(phn1, 4) phn = "1-(" & phn2 & ") " & phn3 & "-" & phn4 MsgBox "Mail message arrived: " & phn Set c = xlApp.Cells.Find(What:=phn, LookIn:=xlValues) If Not c Is Nothing Then MsgBox "found" & Excel.ActiveCell.Offset(0, -2) MsgBox "Mail message arrived: " & phn 'does not pop up Else MsgBox "not found" MsgBox "Mail message arrived: " & phn 'does not pop up ' I would expect THIS or the one above, but it does not.... End If End Sub |
#2
Posted to microsoft.public.excel.programming,microsoft.public.outlook.program_vba
|
|||
|
|||
trying to search excel from Outlook... NO Results
You don't ever initialize xlApp. You probably need a line:
set xlApp = Getobject(, "Excel.Application") if you have error handling, perhaps that is suppressing the error. -- Regards, Tom Ogilvy Phillips wrote in message news:E6tBb.488526$Tr4.1332584@attbi_s03... I am trying to find a phone number that is located in an excel spreadsheet. The phone number is the last 10 digets in the subject of an email. The phone should be found in workbook "Current" and the worksheet "Master" The format of the phone is 1-(xxx) xxx-xxxx in the excel spreadsheet, so it should be being found, but it is not... I am calling this from a script being ran by RULES in outlook when a given string is found. That part is working, but I can not getting anything after the MsgBox "Mail message arrived: " & phn If I move the above line in to the if found (even in the else!) I get nothing... TIA, Phil ------------------------- Sub Phonetest(Item As Outlook.MailItem) Dim phn As String, phn1 As String, phn2 As String, phn3 As String, phn4 As String Dim xlApp As Excel.Application phn1 = Right(Item.Subject, 10) phn2 = Left(phn1, 3) phn3 = Mid(phn1, 4, 3) phn4 = Right(phn1, 4) phn = "1-(" & phn2 & ") " & phn3 & "-" & phn4 MsgBox "Mail message arrived: " & phn Set c = xlApp.Cells.Find(What:=phn, LookIn:=xlValues) If Not c Is Nothing Then MsgBox "found" & Excel.ActiveCell.Offset(0, -2) MsgBox "Mail message arrived: " & phn 'does not pop up Else MsgBox "not found" MsgBox "Mail message arrived: " & phn 'does not pop up ' I would expect THIS or the one above, but it does not.... End If End Sub |
#3
Posted to microsoft.public.excel.programming,microsoft.public.outlook.program_vba
|
|||
|
|||
trying to search excel from Outlook... NO Results
I do not have any error handling...
I will try the additional line. I currently have had excel open already. Thanks Phil "Tom Ogilvy" wrote in message ... You don't ever initialize xlApp. You probably need a line: set xlApp = Getobject(, "Excel.Application") if you have error handling, perhaps that is suppressing the error. -- Regards, Tom Ogilvy Phillips wrote in message news:E6tBb.488526$Tr4.1332584@attbi_s03... I am trying to find a phone number that is located in an excel spreadsheet. The phone number is the last 10 digets in the subject of an email. The phone should be found in workbook "Current" and the worksheet "Master" The format of the phone is 1-(xxx) xxx-xxxx in the excel spreadsheet, so it should be being found, but it is not... I am calling this from a script being ran by RULES in outlook when a given string is found. That part is working, but I can not getting anything after the MsgBox "Mail message arrived: " & phn If I move the above line in to the if found (even in the else!) I get nothing... TIA, Phil ------------------------- Sub Phonetest(Item As Outlook.MailItem) Dim phn As String, phn1 As String, phn2 As String, phn3 As String, phn4 As String Dim xlApp As Excel.Application phn1 = Right(Item.Subject, 10) phn2 = Left(phn1, 3) phn3 = Mid(phn1, 4, 3) phn4 = Right(phn1, 4) phn = "1-(" & phn2 & ") " & phn3 & "-" & phn4 MsgBox "Mail message arrived: " & phn Set c = xlApp.Cells.Find(What:=phn, LookIn:=xlValues) If Not c Is Nothing Then MsgBox "found" & Excel.ActiveCell.Offset(0, -2) MsgBox "Mail message arrived: " & phn 'does not pop up Else MsgBox "not found" MsgBox "Mail message arrived: " & phn 'does not pop up ' I would expect THIS or the one above, but it does not.... End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Convert Google Business Search Results to Excel? | Excel Discussion (Misc queries) | |||
Export Search results to Excel | Excel Discussion (Misc queries) | |||
Can I create a list from the results of a file search in Excel? | Excel Discussion (Misc queries) | |||
dump file search results into excel | Excel Discussion (Misc queries) | |||
Excel search results are hard to identify. | Excel Worksheet Functions |