I have been looking for a macro which will extract data from the currently highlighted email in outlook and append it to a specified worksheet in an Excel workbook.
If the incoming body contains
Name: Joe Bloggs
Age:32
then the macro should send the data to the next empty row in the sheet.
Does anyone know how I can do this or provide a link with some examples to work from.
tia
is this for a personal solution for or has it got to work within a corporate network and exchange server?
How will the workbook be identified?
Is it always the same data?
Is the incoming email a fixed format?
It all affects how to tackle the solution.
Hope this was useful or entertaining.
The solution is a personal one on a stand alone PC.
The data is always in the same format and the only changes are in the values of the data.
OK,
but I can only be half helpfulas I don't have outlook installed on this PC.
Basically there are two options: 1. write an excel macro to get the data from Outlook and 2. write an Outlook macro to push the data to Excel.
in your case you will be better off with an Outlook Macro. You will need to add Excel as a reference in tools. and makesure you decalre Range object with the full class name or you will have problems.
I think when you install Outlook it doesn't install all the programming part unless you specifically request it.
If you are still stuck in a week ask me again I might be back with another PC.
Hope this was useful or entertaining.
I have a similar issue but have never created a macro for Outlook or Excel.
I have 2 forms on the web that are sent to an email box/folder. When I export them chosing only the body as a Windows Tab Delimited text file there is a lot of other information that goes into the cells not just the form field information. Here are the two forms.
Form 1
First Name:
Last Name:
Your e-Mail Address:
Program Confirmation Number:
Form 2
First Name:
Last Name:
Your e-Mail Address:
Participation Verification Code:
It would be great to be able to append the information into Excel but I would settle for just getting the field information cleanly into columns. If anyone has a macro that I can use as a starting point it would be very helpful.
Thanks,
Denny
I have trawled the net looking for anything that would let me move just one item of data.
It would give me a start and I would have something to work with.
I can't believe that so few people would find this useful that no-one would create such a macro.
If you do this from Outlook you will not run into security issues. If you do this from Excel or some other program Office will throw up warning messages every time you try to read the body of the email.
This would work from Outlook - but you could change it to work from excel as well
you could even add this as a button in outlook. Then just select a message and press the button.'Sub sendtoaccess() 'Dim out_app As Outlook.Application 'Dim out_Exp As Outlook.Explorer 'Dim out_Sel As Outlook.Selection 'Dim out_mail As Outlook.MailItem Set out_app = Application 'get the active explorer Set out_Exp = out_app.ActiveExplorer ' If out_Exp.CurrentFolder.WebViewOn = False Then Set out_Sel = out_Exp.Selection Else MsgBox "wrong item type" Set out_Exp = Nothing Exit Sub End If ''first make sure they have only choosen one item if not exit sub If out_Sel.Count > 1 Then MsgBox "more than one item" Exit Sub Else If out_Sel.Count = 0 Then MsgBox "nothing choosen" Exit Sub End If End If ' ''check that it is in fact an email that has been choosen If Not out_Sel.Item(1).Class = olMail Then MsgBox "not an email" Exit Sub End If ' ' 'next try to get the email item - if there is an error 13 then it is encrypted - you may not need this one On Error Resume Next Set out_mail = out_Sel.Item(1) If Err.Number = 13 Then Err.Clear MsgBox "email encrypted" Exit Sub End If ' ' ''*********************************** ''now you have your email item so you can get any property you want ''I will just show an example '' ' Dim str_emailBody As String Dim str_emailSubject As String ' str_emailBody = out_mail.Body str_emailSubject = out_mail.Subject 'add your others here. Then you need to decide how to get this to excel. '
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks