Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.outlook.program_vba
external usenet poster
 
Posts: 48
Default 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   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.outlook.program_vba
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.outlook.program_vba
external usenet poster
 
Posts: 48
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Google Business Search Results to Excel? [email protected] Excel Discussion (Misc queries) 0 October 1st 07 10:01 PM
Export Search results to Excel QBob Excel Discussion (Misc queries) 2 October 17th 06 09:50 PM
Can I create a list from the results of a file search in Excel? jeejee_r Excel Discussion (Misc queries) 1 May 25th 06 07:25 PM
dump file search results into excel Nadia Excel Discussion (Misc queries) 2 July 29th 05 02:43 AM
Excel search results are hard to identify. Monique Excel Worksheet Functions 2 March 18th 05 12:57 AM


All times are GMT +1. The time now is 11:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"