merhaba.
sadece excel@excel.web.tr den gelen maillerin ekli dosyalarını kaydetmek istiyorum. bunun için aşağıdaki kodda nasıl bir değişiklik yapmalıyım.
Public WithEvents myOlItems As Outlook.Items
Private Sub Application_NewMail()
Set myOlItems = _
Outlook.Session.GetDefaultFolder(olFolderInbox).It ems
End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
Const sPfad As String = "C:\deneme\"
Dim iAttachCnt As Integer
Dim i As Integer
If TypeName(Item) = "MailItem" Then
With Item.Attachments
iAttachCnt = .Count
If iAttachCnt > 0 Then
For i = 1 To iAttachCnt
.Item(i).SaveAsFile sPfad & .Item(i).FileName
Next i
End If
End With
End If
End Sub
sadece excel@excel.web.tr den gelen maillerin ekli dosyalarını kaydetmek istiyorum. bunun için aşağıdaki kodda nasıl bir değişiklik yapmalıyım.
Public WithEvents myOlItems As Outlook.Items
Private Sub Application_NewMail()
Set myOlItems = _
Outlook.Session.GetDefaultFolder(olFolderInbox).It ems
End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
Const sPfad As String = "C:\deneme\"
Dim iAttachCnt As Integer
Dim i As Integer
If TypeName(Item) = "MailItem" Then
With Item.Attachments
iAttachCnt = .Count
If iAttachCnt > 0 Then
For i = 1 To iAttachCnt
.Item(i).SaveAsFile sPfad & .Item(i).FileName
Next i
End If
End With
End If
End Sub
