Re: Chech the subject > [searching the database] > [Reply answer]



Am Fri, 07 Apr 2006 16:58:26 GMT schrieb Filips Benoit:

Do you want to return the e-mail to the sender? Then you could use the Reply
function instead of Forward.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Yes, but now i'm formarding to a address that's in the code.
But, how to find the senders email-address?

f


"Michael Bauer" <mb@xxxxxxxx> wrote in message
news:z1wuctfjsuqp.1q1ardxokh5fe$.dlg@xxxxxxxxxxxxx
Am Tue, 04 Apr 2006 07:02:08 GMT schrieb Filips Benoit:

Sorry, I don´t understand your question. In your sample you´re forwarding
the message already.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


OK first test works fine, but how to forward to the sender?
The whole testcode after ***************************



'Address the message
myForward.Recipients.Add ???????????

Thanks,

Filip

*********************************
Public WithEvents myOlItems As Outlook.Items

Public Sub Application_Startup()

' Reference the items in the Inbox. Because myOlItems is declared
' "WithEvents" the ItemAdd event will fire below.
Set myOlItems = Outlook.Session.GetDefaultFolder(olFolderInbox).Items

End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)

On Error GoTo errHandling

Dim MyMailItem As MailItem
Dim iQuestionType As Integer
Dim strAnswer As String
' Check to make sure it is an Outlook mail message, otherwise
'subsequent code will probably fail depending on what type
'of item it is.
If TypeName(Item) = "MailItem" Then
Set MyMailItem = Item
'Check if Database-question
If InStr(MyMailItem.Subject, "YAMAQ") > 0 Then
iQuestionType = FindQuestionType(MyMailItem.Subject)
Select Case iQuestionType
Case Is = 1: strAnswer = "ok1"
End Select
'Forward the item just received
Set myForward = Item.Forward

'Address the message
myForward.Recipients.Add "treesdheedene@xxxxxxxxxx"
myForward.Subject = "Yamagata: DB-answer"
myForward.Body = strAnswer
' Send it
myForward.Send
End If
End If

errHandling:
MsgBox Err.Number & " " & Err.Description
End Sub


Public Function FindQuestionType(ByVal strSubject As String) As Integer
FindQuestionType = 1
End Function

***********************************
"Michael Bauer" <mb@xxxxxxxx> wrote in message
news:1wsc5syr6fauv.1peo1ygra7n24$.dlg@xxxxxxxxxxxxx
Am Mon, 03 Apr 2006 19:10:55 GMT schrieb Filips Benoit:

Filip, simply use the ItemAdd event of the Inbox folder.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Dear All,

I never have written code in Outlook! My native workspace is Access
and
Excel.

How can I reply an email after surching the sql-database.
The emails are recogniced by fixed subject as 'OrderStatus 123654789'
or
'OrderDelDate 123456789'.
The code should run on each incomming email. HOW ??? ( Chech the
subject

[searching database] > [Reply answer])
The hole process should be automated, no action or checks of anybody!
Simple reply as 'OrderDelDate 123456789 = 12/12/2006'
(Searching the database in no problem)

I could do it from access using the timer-event, checking the inbox,
etc
...
But it certenly can be done in Outlook with your help.

THANK³,

Filip
.



Relevant Pages