Outlook 2000 
Author Message
 Outlook 2000

Is there away to copy attachment to the harddrive using VB


Mon, 13 Sep 2004 03:29:55 GMT  
 Outlook 2000
We may need to use CDO, here is just a sample routine to direct the way.

Note: running the sample codes need the message item (current item)
opening, and you may modify the codes based on your needs.

Sub saveattachment()

   Dim name As String

   Dim attitem As Outlook.MailItem

   Dim attapp As Outlook.Application

   Dim myattachments As Outlook.Attachments

   Set attapp = CreateObject("Outlook.Application")

   Set attitem = Application.ActiveInspector.CurrentItem

   Set myattachments = attitem.Attachments

    If attitem.SenderName = "<SenderName>" Then

       If attitem.Subject = "<Subject>" Then

           If attitem.Attachments.Count <> 0 Then

           name = Right(myattachments.Item(1).DisplayName, 3)

               myattachments.Item(1).SaveAsFile "C:" &
myattachments.Item(1).DisplayName

           End If
       End If
   End If

End Sub

Please refer to MSDN for more about CDO, the article below may be helpful.

OL2002: Programming Examples for Referencing Items and Folders[ol10codekb]
http://support.microsoft.com/support/kb/articles/q290/8/04.asp

Best Regards,

Alick Ye

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. Copy right, 2002 Microsoft Corporation.
All rights reserved.



Mon, 20 Sep 2004 15:06:24 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. form of outlook xp to outlook 2000 sp3

2. Mosher Outlook 2000 Code wont run in Outlook 2002

3. Changes in the Item.GetInspector.CommandBars from Outlook 2000 to Outlook XP

4. outlook 2000 and outlook 97 display differently

5. CDO vs Outlook 2000 Object Library?? (Outlook Newbie)

6. Prob : Adding contacts for Outlook 2000 and Outlook 97

7. VBA in Outlook XP Vs Outlook 2000.

8. Outlook 2000 or Outlook XP banner in startup box

9. References dropping out between Outlook 2000 and Outlook 98

10. Programs folder (Outlook 2000 or Outlook Express

11. Outlook 98 vs Outlook 2000

12. Question regarding MAPI, MS Outlook 2000, and Outlook Express 6

 

 
Powered by phpBB® Forum Software