A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Capturing date from message



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 30th 11, 10:04 PM
Pedro Blandino Pedro Blandino is offline
Junior Member
 
First recorded activity at Outlookbanter: Nov 2011
Posts: 1
Smile Capturing date from message

I need to create an auto response that will read an specific date on the body of the message and will reply to the sender.

The email is comming from a request for appointment on one of our websites and it allways have the same Body

How can i create the auto reply that will read from a message like this

From: xxxx ]
Sent: Wednesday, November 30, 2011 11:15 AM
To: xxx Sales
Subject: Appointment Request xxxx


FirstName: xxxxxxx
LastName: xxxxxxx
EmailAddress:
ChoseADayToVisit: 12/02/2011
chose_a_time_to_visit: 11:00am - 12:00pm
comments:

phone: (xxx) xxx-xxxx


And reply something like this

“Thank you (FirstName) (LastName) for your request for an appointment on (insert date) at (insert time)….yadda yadda, blah blah.


Any help is apreciated

Pedro
Ads
  #2  
Old May 31st 12, 11:08 PM
NDuarte NDuarte is offline
Junior Member
 
First recorded activity at Outlookbanter: May 2012
Posts: 6
Default

The following is a way to accomplish what you are looking for. Do note that the sections that have "int_Temp - #" may have to be adjusted based on the actual form received. What it is doing is subtracking the spaces from the end of the array which may be more or less than the actual e-mail you are getting. Just play with it to get it right. In order to get the code to work you are going to have to setup a rule to run it when an e-mail with the proper subject comes in (I am assuming that the subject is autopopulated for the form).

Code:
Public Sub AutoReply(oMailItem As Outlook.MailItem)
  Dim oMail As Outlook.MailItem
  Dim str_FirstName
  Dim str_LastName
  Dim str_Email As String
  Dim str_Date
  Dim str_Time
  Dim arr
  Dim int_Temp As Integer
  Dim str_Body As String

  On Error Resume Next

  arr = Split(oMailItem.Body, ":")
  
  
  int_Temp = Len(arr(6))
  str_FirstName = Mid(arr(6), 2, int_Temp - 13)
    
  int_Temp = Len(arr(7))
  str_LastName = Mid(arr(7), 2, int_Temp - 16)
  
  int_Temp = Len(arr(8))
  str_Email = Mid(arr(8), 2, int_Temp - 17)
  
  int_Temp = Len(arr(9))
  str_Date = Mid(arr(9), 2, int_Temp - 25)
  
  int_Temp = Len(arr(12))
  str_Time = arr(10) & ":" & arr(11) & ":" & Mid(arr(12), 1, int_Temp - 10)
  
  str_Body = "Thank you " & str_FirstName & " " & str_LastName & " for your request for an appointment on " & str_Date & " at" & str_Time & " ... yadda yadda, blah blah."

'Create a new mail item
Set oMail = Application.CreateItem(olMailItem)

'Set the proper fields of the e-mail and send it
With oMail
  .To = oMailItem.SenderEmailAddress
  .Subject = " " & oMailItem.Subject
  .Body = str_Body
  
  '.Display
  .Send
End With


End Sub
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Capturing events with IDispEventSimpleImpl framara Add-ins for Outlook 0 May 18th 10 12:34 PM
Capturing OE 6.0 Message Steve[_2_] Outlook Express 1 August 7th 07 01:01 PM
Capturing cursor window Jon Rowlan Outlook and VBA 2 May 16th 07 08:37 AM
Capturing Message URL Avatar Outlook Express 7 January 30th 06 06:47 PM
capturing the currentuser... Martin Outlook and VBA 7 January 17th 06 11:56 AM


All times are GMT +1. The time now is 04:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.