Log in

View Full Version : Capturing a text and putting at Send To



Ahiru
09-13-2011, 07:58 AM
Hi everybody. I need some help for creating a macro for Outlook. I'm not familiarized with VBA, so, I ask you people to explain in a very easily way, ok?

I have form being recieved from my website to my email.
I need that when I click to answer that message to the sender, the macro capture the field "email" from the body message and apply automatically that email to the "To:" field.

I know that I could program my own script of my website, to send the form for me, using the same email that the person writted. But my host blocks that script usage. So, the only sollution I could find is to create that macro in the Outlook.

Waiting for an answer, thank you.

Charlize
09-21-2011, 06:58 AM
Can you show an example of such an email (layout).

Charlize

Ahiru
09-21-2011, 07:11 AM
Can you show an example of such an email (layout).

Charlize

Sure. It looks like this:

Choose Area: Orientation
Name: John B. Johnson
Address: 1st avenue
District: Ipiranga
PO Box: 123456789
City: New York
State: AB
Email: email@example.com
Telephone: 555-456789
Celphone: 555-456789
Message: My message.

Charlize
09-21-2011, 07:31 AM
Try this one to start. Select one message and run this macro. It will display a popup with the, I hope, desired address you need.
Sub Get_Address_From_Current_mail()
Dim mymessage As Outlook.MailItem
Dim thebody As String
Set mymessage = ActiveExplorer.Selection.Item(1)
thebody = mymessage.Body
MsgBox Split(Split(Mid(thebody, InStr(1, thebody, "Email: ") + 7, _
InStr(InStr(1, thebody, "Email: "), thebody, vbCrLf) - _
InStr(1, thebody, "Email: ") - 7), """")(1), ":")(1)
End SubCharlize

Ahiru
09-21-2011, 07:55 AM
Try this one to start. Select one message and run this macro. It will display a popup with the, I hope, desired address you need.
Sub Get_Address_From_Current_mail()
Dim mymessage As Outlook.MailItem
Dim thebody As String
Set mymessage = ActiveExplorer.Selection.Item(1)
thebody = mymessage.Body
MsgBox Split(Split(Mid(thebody, InStr(1, thebody, "Email: ") + 7, _
InStr(InStr(1, thebody, "Email: "), thebody, vbCrLf) - _
InStr(1, thebody, "Email: ") - 7), """")(1), ":")(1)
End SubCharlize
I can't find an option to run the macro inside the email. I use Outlook Express and 2007.

JP2112
09-27-2011, 10:54 AM
Outlook Express (OE) does not support VBA. OE is a part of Windows, while Outlook is part of the Microsoft Office Suite.