Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows
Visual Basic > Internet Web Mail Stuff sample source codes
Strip attachments from email in Outlook.
Strip attachments from email in Outlook. 'Description: To be used in 'stripping' attachments from 'e-mails in your inbox and save them to a hardcoded path. 'This bit of code will strip attachments and save them into the path '"C:\temp\Outlook Attachments", it has no error handling so be warned! 'Code starts (placed under a command button.) Dim oApp As Outlook.Application Dim oNameSpace As NameSpace Dim oFolder As MAPIFolder Dim oMailItem As Object Dim sMessage As String Set oApp = New Outlook.Application Set oNameSpace = oApp.GetNamespace("MAPI") Set oFolder = oNameSpace.GetDefaultFolder(olFolderInbox) For Each oMailItem In oFolder.Items With oMailItem If oMailItem.Attachments.Count > 0 Then '? oMailItem.Attachments.Item(1).SaveAsFile "C:\Temp\Outlook Attachments\" & oMailItem.Attachments.Item(1).filename MsgBox oMailItem.Attachments.Item(1).DisplayName & " was saved as " & oMailItem.Attachments.Item(1).filename End If End With Next oMailItem Set oMailItem = Nothing Set oFolder = Nothing Set oNameSpace = Nothing Set oApp = Nothing
Privacy Policy
|
Link to Us
|
Links