Auto Save

E

Edgar Thoemmes

Hi

I had the following reply (below) from Dmitry yesterday
but I do not know how to define the attachment type to
olByValue for the code below. I have tried attachment.type
= olbyValue but this still doesnt save the attachment to
the hard disk. Sorry to keep bugging everyone but i am a
complete amateur when it comes to Outlook.

Thanks for your help

Private Sub objInbox_ItemAdd(ByVal Item As Object)

If Item.Class = olMail And Item.SenderName = "Edgar
Thoemmes" Then

If Item.Attachments.Count > 0 Then

Dim objAttachments As Outlook.Attachments
Set objAttachments = Item.Attachments
For Each objAttach In objAttachments

'Does not handle duplicate filename scenarios

Item.Attachment.Type = olByValue

objAttach.SaveAsFile "C:\remit\" &
Item.Subject & ".rtf"
Next
Set objAttachments = Nothing
End If
End If


End Sub





Subject: Re: Saving Attachments
From: "Dmitry Streblechenko \(MVP\)"
<[email protected]> Sent: 1/21/2004 10:03:03 AM




Are you sure sure? Replying to an e-mail will put a "RE: "
prefix to the
subject, that won't be valid for a filename. Why not use
the
Attachment.Filename property, or at the very list loop
through all subject
chars replacing all invalid chars with, say, "_"?
Check the attachment type - Attchment.Type must be
olByValue for SaveAsFile
to work properly.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Edgar Thoemmes" <[email protected]>
wrote in message
Hi

i have to use the subject of the message as the file name
as these are sent from Crystal Reports which generates one
file name for a report and we split it up by emailing them.

The subject will never contain any invalid characters. I
am not to bothered about the pop up box at the moment as
our back office staff are looking at it.

The problem is the attachments are still not saving. Any
help would be much appreciated.

Thanks
contain
invalid characters them that would


..
 
K

Ken Slovak - [MVP - Outlook]

You can't change that value, Dmitry was suggesting you check it.

If objAttach.Type = olByValue Then
'good to go
Else
'whatever
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top