Hi !! This is a real tough one!!!! can any help!! Basically the code below should open up oulook (2000) and look throught the inbox and find any email which has an attachment which is named "openxl.mdb". but the code does not work!!. I really could do with some help here . I need to get mdb's from outlook inbox (as mail attachments) into a temp folder, from Access 2000. I have trying this solution for days now!! but getting more and more fed up!! and i need to have it done very soon!! CAN RELY ON YOU EXPERTS !! TO FIND ME A SOLUTION!! OR POINT ME IN SOME DIRECTION OF HOPE!!! AWAIT EAGERLY!!!
THANKS
MILAN
Private Sub Command7_Click()
Dim objOL As Outlook.Application
Dim objMsg As Object
Dim objAttachments As Outlook.Attachments
Dim objSelection As Outlook.Selection
Dim i As Long
Dim lngCount As Long
Dim strFile As String
Dim strFolder As String
Dim strerFile As String
On Error Resume Next
Set objOL = CreateObject("Outlook.Application")
' Get the collection of selected objects.
Set objSelection = objOL.ActiveExplorer.Selection
strFolder = "C:\DUMP"
If strFolder = "" Then
MsgBox "Could not get Temp folder", vbOKOnly
GoTo ExitSub
End If
'objMsg.objSelection
objMsg.Class = olMail
' Get the Attachments collection of the item.
Set objAttachments = objMsg.Attachments
strFile = objAttachments.Item(i).OPENXL.mdb
strerFile = strFolder & strFile
objAttachments.Item(i).SaveAsFile strerFile
objMsg.Save
ExitSub:
Set objAttachments = Nothing
Set objMsg = Nothing
Set objSelection = Nothing
Set objOL = Nothing
End Sub
THANKS
MILAN
Private Sub Command7_Click()
Dim objOL As Outlook.Application
Dim objMsg As Object
Dim objAttachments As Outlook.Attachments
Dim objSelection As Outlook.Selection
Dim i As Long
Dim lngCount As Long
Dim strFile As String
Dim strFolder As String
Dim strerFile As String
On Error Resume Next
Set objOL = CreateObject("Outlook.Application")
' Get the collection of selected objects.
Set objSelection = objOL.ActiveExplorer.Selection
strFolder = "C:\DUMP"
If strFolder = "" Then
MsgBox "Could not get Temp folder", vbOKOnly
GoTo ExitSub
End If
'objMsg.objSelection
objMsg.Class = olMail
' Get the Attachments collection of the item.
Set objAttachments = objMsg.Attachments
strFile = objAttachments.Item(i).OPENXL.mdb
strerFile = strFolder & strFile
objAttachments.Item(i).SaveAsFile strerFile
objMsg.Save
ExitSub:
Set objAttachments = Nothing
Set objMsg = Nothing
Set objSelection = Nothing
Set objOL = Nothing
End Sub