Help?!

  • Thread starter Thread starter -=Sojourn=-
  • Start date Start date
S

-=Sojourn=-

I'm trying to processing forwards that come into my account. I
have emails that have fowarded emails, within forwared emails, with
forwarded emails... etc.. etc. etc... then the actual message..

What I want to do is have outlook process the emails so just the actual
message is there...


Sub Unknown()
' Dim a bunch of variables...

Set oNameSpace = Application.GetNamespace("MAPI")
Set ofInbox = oNameSpace.GetDefaultFolder(olFolderInbox)
Set SubFolder = ofInbox.Folders("Temp")
iFor = 1

Do
If SubFolder.Items(iFor).Class = olMail Then
Set oMail = SubFolder.Items(iFor)
For Each att In oMail.Attachments

sExt = LCase(Right(att.FileName, 3))
If sExt = "jpg" Then Exit For
If sExt = "gif" Then Exit For

If sExt = "msg" Then
Set oMailNew = att ' <--- This line doesn't work
End If
Next att

Set oMail = Nothing
End If
iFor = iFor + 1
Loop Until iFor >= (SubFolder.Items.Count - 1)
End Sub

Any help would be appreciated...
Thanks!
 
Set oMailNew = att ' <--- This line doesn't
work

"att" is type of Outlook.Attachment, so oMailNew needs to be the same
type.
 
Maybe you are interested in another tipp:
Do
If SubFolder.Items(iFor).Class = olMail Then

Using this late bound property check in a loop is very expensive, e.g. a
loop with 10.000 items on my machine:

1) If TypeOf obj Is Outlook.MailItem (needs 0.01 seconds)
2) If obj.Class=olMail (needs more than 4 seconds)

That´s an increase of about 42000%!
 
But the attachement is an embeded email... is there a way to make it
so
I can convernt the attachement email, to a object of email?


Please, do not post to me privat.

The file type of your attachment doesn´t matter at this point. Save the
attachment onto your file system, then you can open a *.msg file by
using the Application.CreateItemFromTemplate method.
 
Back
Top