Need help with getting my own outlook mail address to excel using macro

karthik R

New Member
Joined
Aug 29, 2015
Messages
2
Guys...I want my own outlook mail address to be extracted and shown in excel cell . This is for my ofc use. kindly help e this.. simple macro or fuctions to show my own outlook mail address in excel cell.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi and welcome to the MrExcel Message Board.

This code gets three strings. At least one of them should be what you are looking for:
Code:
' Requires Tools-->References-->Microsoft Outlook 15.0 Object Library
Sub getEmailAddress()

    Const PR_SMTP_ADDRESS As String = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
    
    Dim olApp As Outlook.Application
    Dim olNS As Outlook.Namespace
    Dim olRec As Outlook.Recipient
    Dim olPA As Outlook.PropertyAccessor

    Set olApp = New Outlook.Application
    Set olNS = olApp.GetNamespace("MAPI")
    Set olRec = olNS.CurrentUser
    Set olPA = olRec.PropertyAccessor
    
    Range("A1") = olNS.CurrentUser
    Range("A2") = olNS.Accounts(1)
    Range("A3") = olPA.GetProperty(PR_SMTP_ADDRESS)
    
End Sub
Note that the way this code is written you will need to set a reference to the Outlook Object Library. Mine is v15.
In the VB Editor select: Tools-->References-->Microsoft Outlook 15.0 Object Library
 
Upvote 0
Thnak you... please help me to get the below address u mentioned above..... where to get that??

Const PR_SMTP_ADDRESS As String = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,865
Members
449,052
Latest member
Fuddy_Duddy

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