Finding an email in Ol2007 from Excel2007

Checho78

New Member
Joined
Apr 29, 2010
Messages
2
When a certain user gets some emails he selects them and hits Ctrl+C then goes to an Excel Sheet and pastes that information. When doing this he gets From, Subject, Received, Size and Categories.
This emails are then assigned to several people and my Excel sheet already does the assigning and all.
Now what I need is a way for Excel to find that email in either one of two sub folders in outlook named "East" and "West" and then forward it to whoever it was assigned to.
I've looked all over the internet but I cannot find anything similar to my issue.
Once the email has been located I think I can have VBA send it but so far I have not been able to locate emails.
:rolleyes:
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hello and welcome to The Board.
As a starter, have a look at the following code:
Code:
Option Explicit
' You must set Tools | References for the following item:
' Microsoft Outlook 12.0 Object LIbrary
Sub Find_Emails()
Dim objOutlook As Outlook.Application
Dim objNS As Outlook.Namespace
Dim objFolder1 As Outlook.Folder
Dim objItem As Outlook.MailItem
    '
    Set objOutlook = CreateObject("Outlook.Application")
    Set objNS = objOutlook.GetNamespace("MAPI")
    Set objFolder1 = objNS.Folders("Personal Folders").Folders("Inbox")
    '
    For Each objItem In objFolder1.Items
        If objItem.UnRead = True Then
            If objItem.Class = olmail Then
                With objItem
                    MsgBox .Subject & vbCrLf & _
                            .SenderName
                End With
            End If
        End If
    Next objItem
'
Error_Para:
    Set objOutlook = Nothing
    Set objNS = Nothing
    Set objFolder1 = Nothing
    Set objItem = Nothing
End Sub
Note that the code does not contain any error-trapping.
You can obviously add more properties to the 'Msgbox' in the example.
If you want to copy text from the body of the email to Excel, the easiest way is probably to copy that to a text file that can be saved, re-opened and read line by line.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,432
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top