Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OL2000 VBA How to copy attachment to local drive

Status
Not open for further replies.

AnNguyen

Programmer
Jul 18, 2002
33
0
0
US
Hi all.
I use OL2000 sp3. I have a form to scan the inbox for certain meassage. my questionis how i copy the attachment of these message to local drive (i.e C:\)

What did i do wrong. can some one help or point me to the right path.

Thank you and below is my code.

sub Function Item_Open()
' Open form...
Dim i, temp


Set objSession = Application.CreateObject("MAPI.Session")
objSession.Logon
Set objInbox = objSession.Inbox ' inbox

set objMessages = objThisFolder.Messages ' mail collection

set objCurrMessage = objMessages.Item(1) 'first mail

for each tmpAttachment in objCurrMessage.Attachments
tmpAttachment.SaveAsFile "C:\" & "abc.msg"
next

' SaveasFile error: (object does not support method or
' property Saveasfile.
'
End function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top