Run Time Error 438 Object Doesnt Support this Property or Method

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.
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:

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Most likely you are processing something that is not a mail item and therefore doesn't have all the properties you want. You should check the Class to see if it's olMail first.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top