Firstartemis
New Member
- Joined
- Jun 17, 2015
- Messages
- 10
Thank you to all who have helped me before. Without you guys, I would still be lost in the many projects my bosses think I can handle in my off time...
I've been given a task to automate a survey that will be sent via email (survey sample response below). Due to inbox limitations and bandwidth I'm thinking it would be better to receive the form via plain text (business practices forbid html), although we will be sending the form out via word form. I'm looking for a macro that parses outlook 2007 and populates an access database. Additionally, if it could automatically delete the email after parsing, it would be extremely helpful.
Notes: Each 2 letter abbreviation corresponds to a separate part of the form with MF## having upto 100 options
Thank you for your assistance.
email macro
Sample Response:
I've been given a task to automate a survey that will be sent via email (survey sample response below). Due to inbox limitations and bandwidth I'm thinking it would be better to receive the form via plain text (business practices forbid html), although we will be sending the form out via word form. I'm looking for a macro that parses outlook 2007 and populates an access database. Additionally, if it could automatically delete the email after parsing, it would be extremely helpful.
Notes: Each 2 letter abbreviation corresponds to a separate part of the form with MF## having upto 100 options
Thank you for your assistance.
email macro
Code:
Private Sub CommandButton1_Click()
Dim outlookapp As Object
Dim item As Object
Dim subject As String
Dim strEmail As String
Dim strBody As String
Dim Doc As Document
Set Doc = ThisDocument
strEmail = Doc.FormFields("txtCRep").Result
strBody = "Do not edit anything below this line" & Chr(13)
Dim fld As FormField
For Each fld In ActiveDocument.FormFields
If fld.Result <> "0" Then
strBody = strBody + (fld.Name & Chr(124) & fld.Result & Chr(13))
End If
Next
Set outlookapp = CreateObject("outlook.application")
subject = "RNA"
Set item = outlookapp.CreateItem(0)
With item
.To = strEmail
.subject = subject
.Body = strBody
.Display
End With
End Sub
Sample Response:
Code:
Do not edit anything below this line
txtCRep|
MI3|1
MI7|1
Rank|E1
Branch|USN
Rate|Im1
Lname|Smart
Command|USS Neversail
FName|Fellar
Department|
Memail|first.last@myemail.mil
Division|
CEmail|
WCenter|
WPhone|(123) 456-7890
PRD|
EAOS|
CPhone|(124) 567-7890
MF9|1
MF11|1
MF50|1
MF27|1
MF31|1
MN2|1
MN6|1
In2b|
IN3|1
IN5|1
OIQ|My response is here