Salve ho questa macro e quando vado ad eseguire la sub isexcel prendo come errore "runtime error 424", non riesco a capire come mai in quanto l'oggetto che passo lo vedo definito:
Option Explicit
Dim WithEvents myInboxMailItem As Outlook.Items
Public Sub Initialize_handler()
Dim strMailBoxName As String
strMailBoxName = "Mailbox xxxxxx"
Dim fldInbox As Outlook.MAPIFolder
Dim gnspNameSpace As Outlook.NameSpace
Set gnspNameSpace = Outlook.GetNamespace("MAPI") 'Outlook Object
Set fldInbox = gnspNameSpace.Folders(strMailBoxName).Folders("Inb ox")
Set myInboxMailItem = fldInbox.Items
End Sub
Private Sub myInboxMailItem_ItemAdd(ByVal Item As Object)
Debug.Print ("Nuova mail su: Mailbox - IBM Servizi Infrastrutturali - COGMPS")
Debug.Print (Item.Subject)
Debug.Print (TypeName(Item))
Debug.Print (Item.Subject)
Dim x As New TicketChange
Dim mail As MailItem
Set mail = Item
Dim attach As attachment
For Each attach In mail.Attachments
isExcel (attach) '<< l'errore lo prendo qui >>>
Next attach
End Sub
Private Sub isExcel(file As attachment)
MsgBox (file.Type)
MsgBox (file.filename)
MsgBox (file.PathName)
MsgBox (file.Position)
End Sub