• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to get properties of Outlook in excel cell

ThrottleWorks

Excel Ninja
Hi,

I am working on Outlook through excel VBA.
On top of Inbox folder of my Outlook, I can see
name.surname@company.com.

If I right click on Inbox --> Properties --> Location =
name.surname@company.com
How to get this detail in excel with VBA. Can anyone please help me in this.

Apologies for not uploading sample workbook. Thanks for your time.

Help only if you get time.
At present I am manually populating values in cell F2.
Please see highlighted line in below code.
I am trying to remove manual intervention here.

Code:
Sub Display_All_Drafts()

    Dim lDraftItem As Long
    Dim myOutlook As Outlook.Application
    Dim myNameSpace As Outlook.Namespace
    Dim myFolders As Outlook.Folders
    Dim myDraftsFolder As Outlook.MAPIFolder
  
    Set myOutlook = Outlook.Application
    Set myNameSpace = myOutlook.GetNamespace("MAPI")
    Set myFolders = myNameSpace.Folders
  
    Dim MacroSht As Worksheet
    Set MacroSht = Worksheets("Main")
      
    Dim UserSht As Worksheet
    Set UserSht = ThisWorkbook.Worksheets("User Names")
      
    Set myDraftsFolder = myFolders(UserSht.Range("F2").Value).Folders("Drafts")
  
    For lDraftItem = myDraftsFolder.Items.Count To 1 Step -1
        myDraftsFolder.Items.Item(lDraftItem).Display
    Next lDraftItem
  
    'Clean-up
    Set myDraftsFolder = Nothing
    Set myNameSpace = Nothing
    Set myOutlook = Nothing
End Sub
 
Last edited:
Back
Top