Have you tried it as below, keep in mind you need to specify the name of the shared mailbox in the below code:
When I tested the above code the folders that I located were in a shared mailbox but outside of the shared mailbox inbox so to speak.Dim mynamespace As outlook.Namespace Dim strRowData As String Dim strDelimiter As String Dim myDestFolder As outlook.Folder Dim ShareInbox As outlook.MAPIFolder Dim SubFolder As Object Dim InputFolder As String Dim OutputFolder As String Dim ProdMail As String Dim SavePath As String Dim oXLApp As Object, oXLwb As Object, oXLws As Object Dim lRow As Long On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Open the relevant file SavePath = "\\C:\Macro" Set oXLwb = oXLApp.Workbooks.Open(SavePath & "\Test.xlsx") 'Extract Mailbox and subfolder details from a sheet named as "Folder Details" Set oXLws = oXLwb.Sheets("Folder Details") ProdMail = oXLws.Range("B1") InputFolder = oXLws.Range("B2") OutputFolder = oXLws.Range("B3") strRowData = "" ' Code to extract emails from specific subfolder within shared folder and copy the data across excel spreadsheet. Set mynamespace = outlook.GetNamespace("MAPI") Set ShareInbox = mynamespace.Session.Folders.Item("Name of shared mailbox") ' change to suit Set SubFolder = ShareInbox.Folders.Item(InputFolder) 'Change this line to specify folder Set myDestFolder = ShareInbox.Folders.Item(OutputFolder)




Reply With Quote