Hello All!
I am working on a problem where I need to...
1. Receive an email
2. Have that email automatically moved to a specific folder
3. Have any email in said folder exported into a .csv file
4. The data in that file must be placed under specific columns.
I can achieve all of the above, except #4. The script places the entire body of the email in different cells depending on breakpoints.
Here's a copy of the email I need to export:
********************************************
Area of Interest: Post a Job
Type of Job: Full-time
Campus Location: Montgomery
---------------------
Contact Information:
Title: Manager
Contact Last Name: Wilson
Contact First Name: Allison
Address: 3424 Peachtree Rd NE
City: Atlanta
State: Georgia
Zip: 30326
Phone: 4042669876
Email: specialtyma@pyapc.com
---------------------
Company Information:
Company Name: Pershing, Yoakley & Associates
Company Phone: 4042669876
Company Fax Number:
Company Website:
Type Of Business:
---------------------
Job Details:
Job Title: Medical Assistant
Start Date:
Job Type: Full-time
Salary Range: to
Referral Source:
---------------------
Job Description:
A specialty practice in Montgomery, AL seeks a Medical Assistant. Prior experience in a medical practice is preferred. Candidates must have great interpersonal and customer service skills, and must be self-starters and multi-taskers – assisting physician with examination and treatment of patient and maintenance of clinical equipment.
Interested candidates should submit their resume to specialtyma@pyapc.com.
---------------------
Application Process:
---------------------
Hiring Process:
Phone Interview: Yes
Background Check: Yes
Reference Check: Yes
Credit Check: No
Technical Test: No
Personality Test: No
Physical Exam: No
Driving Records: No
Other: No
---------------------
Requested way to receive resumes:
Fax: No
Mail: No
Email: Yes
Apply in person: No
Apply online: No
---------------------
Additional Requests:
********************************************
The above areas, highlighted in red, have to fall into the following areas:
[TABLE="class: grid, width: 100%, align: center"]
<tbody>[TR]
[TD]Constituent_ID[/TD]
[TD]Job Title[/TD]
[TD]Company Name[/TD]
[TD]Category Name[/TD]
[TD]Description[/TD]
[TD]Contact Name[/TD]
[TD]Contact Email[/TD]
[TD]Location[/TD]
[TD]Salary[/TD]
[TD]Start Date[/TD]
[TD]End Date[/TD]
[/TR]
</tbody>[/TABLE]
Here is what I have so far (referring to #'s 1-3 above)... which I've placed in ThisOutlookSession of Outlook.
Can someone help me with this?
I am working on a problem where I need to...
1. Receive an email
2. Have that email automatically moved to a specific folder
3. Have any email in said folder exported into a .csv file
4. The data in that file must be placed under specific columns.
I can achieve all of the above, except #4. The script places the entire body of the email in different cells depending on breakpoints.
Here's a copy of the email I need to export:
********************************************
Area of Interest: Post a Job
Type of Job: Full-time
Campus Location: Montgomery
---------------------
Contact Information:
Title: Manager
Contact Last Name: Wilson
Contact First Name: Allison
Address: 3424 Peachtree Rd NE
City: Atlanta
State: Georgia
Zip: 30326
Phone: 4042669876
Email: specialtyma@pyapc.com
---------------------
Company Information:
Company Name: Pershing, Yoakley & Associates
Company Phone: 4042669876
Company Fax Number:
Company Website:
Type Of Business:
---------------------
Job Details:
Job Title: Medical Assistant
Start Date:
Job Type: Full-time
Salary Range: to
Referral Source:
---------------------
Job Description:
A specialty practice in Montgomery, AL seeks a Medical Assistant. Prior experience in a medical practice is preferred. Candidates must have great interpersonal and customer service skills, and must be self-starters and multi-taskers – assisting physician with examination and treatment of patient and maintenance of clinical equipment.
Interested candidates should submit their resume to specialtyma@pyapc.com.
---------------------
Application Process:
---------------------
Hiring Process:
Phone Interview: Yes
Background Check: Yes
Reference Check: Yes
Credit Check: No
Technical Test: No
Personality Test: No
Physical Exam: No
Driving Records: No
Other: No
---------------------
Requested way to receive resumes:
Fax: No
Mail: No
Email: Yes
Apply in person: No
Apply online: No
---------------------
Additional Requests:
********************************************
The above areas, highlighted in red, have to fall into the following areas:
[TABLE="class: grid, width: 100%, align: center"]
<tbody>[TR]
[TD]Constituent_ID[/TD]
[TD]Job Title[/TD]
[TD]Company Name[/TD]
[TD]Category Name[/TD]
[TD]Description[/TD]
[TD]Contact Name[/TD]
[TD]Contact Email[/TD]
[TD]Location[/TD]
[TD]Salary[/TD]
[TD]Start Date[/TD]
[TD]End Date[/TD]
[/TR]
</tbody>[/TABLE]
Here is what I have so far (referring to #'s 1-3 above)... which I've placed in ThisOutlookSession of Outlook.
Code:
Option Explicit
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Set olApp = Outlook.Application
Set objNS = olApp.GetNamespace("MAPI")
'// The INCOMING JOBS folder must be a folder of the INBOX. You didn't specify, so
Set Items = objNS.GetDefaultFolder(olFolderInbox).Folders("Incoming Jobs").Items
End Sub
Private Sub Items_ItemAdd(ByVal item As Object)
On Error GoTo ErrorHandler
Dim Msg As Outlook.MailItem
Dim iFile As Integer
If TypeName(item) = "MailItem" Then
Set Msg = item
iFile = FreeFile
Open "C:\Temp\INCOMING_JOBS.CSV" For Append As #iFile
Print #iFile, Replace(Msg.Body, vbCrLf, ",")
Close #iFile
End If
ExitPoint:
Exit Sub
ErrorHandler:
MsgBox Err.Number & " - " & Err.Description
Resume ExitPoint
'// Debug only
Resume
End Sub
Can someone help me with this?