KungFu Keyboard
New Member
- Joined
- Oct 22, 2016
- Messages
- 26
Hi there,
I have this macro that extracts data from a shared inbox.
I need to set it up on another person computer who has access to a different inbox where the same mail is stored.
The following code runs fine when I point it at one shared inbox, but when I point at a different one I get a run time error 438 Object Doesnt Support this Property or Method.
I have this macro that extracts data from a shared inbox.
I need to set it up on another person computer who has access to a different inbox where the same mail is stored.
The following code runs fine when I point it at one shared inbox, but when I point at a different one I get a run time error 438 Object Doesnt Support this Property or Method.
Code:
Sub OS()
Sheets("Workbench").Visible = True
Application.DisplayAlerts = False
Dim OutlookApp As OUTLOOK.Application
Dim OutlookNamespace As Namespace
Dim Folder As MAPIFolder
Dim OutlookRecipient As OUTLOOK.Recipient
Dim OutlookMail As Variant
Dim I As Integer
Dim lastRow As Long
Set OutlookApp = New OUTLOOK.Application
Set OutlookNamespace = OutlookApp.GetNamespace("MAPI")
Set OutlookRecipient = OutlookNamespace.CreateRecipient("quality@globalloadcontrol.com")
Set Folder = OutlookNamespace.GetSharedDefaultFolder(OutlookRecipient, olFolderInbox).Folders("IR Fullfit")
I = 1
For Each OutlookMail In Folder.Items
If OutlookMail.ReceivedTime >= Range("From_date").Value And _
OutlookMail.ReceivedTime <= Range("To_date").Value Then
Range("eMail_subject").Offset(I, 0).Value = OutlookMail.Subject
Range("eMail_date").Offset(I, 0).Value = OutlookMail.ReceivedTime
Range("eMail_sender").Offset(I, 0).Value = OutlookMail.SenderName
Range("eMail_text").Offset(I, 0).Value = OutlookMail.Body
I = I + 1
End If
Next OutlookMail
Set Folder = Nothing
Set OutlookNamespace = Nothing
Set OutlookApp = Nothing
Set OutlookRecipient = Nothing
Sheets("Workbench").Visible = False
End Sub
Last edited by a moderator: