• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Accessing shared outlook folder doesn't work since switch to new outlook/excel

elbrodero

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
POP3
#1
Hello,

I have a macro that used to work like charm on office 2010. Since the switch to windows 10 and office 365 it only work occasionally. The macro extracts excel files from e-mails that are in a certain sub folder. I am using the macro out of excel.

I used the following code:

Const olFolderInbox As Integer = 6



Sub DownloadAttachmentFirstUnreadEmailSharedMail()
Dim olNamespace As Object
Dim olApp As Object
Dim olNs As Object
Dim olFolder As Object
Dim olRecip As Object
Dim oOlItm As Object
Dim oOlAtch As Object

Set olApp = GetObject(, "Outlook.application")
Set olNs = olApp.GetNamespace("MAPI")
Set olRecip = olNs.CreateRecipient("work@work.de")
Set olFolder = olNs.GetSharedDefaultFolder(olRecip, olFolderInbox).Folders("03_EUR_03")


Unfortunately, the code gets stuck now in the last line giving me the error message "not all object could be found". However, this only happens occasionally.
 
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
#2
I wonder if its a GAL issue - for whatever reason, it cant get into the gal and dies. You can try resolving the olRecip before getting the folder -

Set olRecip = olNs.CreateRecipient("work@work.de")
olRecip.Resolve
Set olFolder = olNs.GetSharedDefaultFolder(olRecip, olFolderInbox).Folders("03_EUR_03")

Do you have the offline address book downloaded? Not sure if it will help resolve it faster, but it might.
 

elbrodero

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
POP3
#3
I included the olRecip.Resolve line into my code but unfortunately it is still showing me an error message sometimes for the line:
Set olFolder = olNs.GetSharedDefaultFolder(olRecip, olFolderInbox).Folders("03_sonst_EUR")

As far as I know I do not have the offline address book downloaded. How can I do this?

But I am wondering what the GAL has to do with this?
 
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
#4
But I am wondering what the GAL has to do with this?
It needs to find the mailbox for this user - olNs.CreateRecipient("work@work.de")

As far as I know I do not have the offline address book downloaded. How can I do this?
Send/Receive menu, expand Send/Receive Groups button - download address book is near the bottom.

Is the 03 subfolder on your computer? it needs to be in your profile to use the code. Are you caching shared folders? Open the account settings dialog, double click on your account then More Settings - advanced tab to check.