P
Phillips
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
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