Sponsored Link

There was an error in this gadget

Sponsored Link

Thursday, November 27, 2008

Accessing Outlook from MS Excel

The post will help you in exporting details like email id, sender's name, date and time of email lying in your Outlook inbox. Similarly, you can modify code to access to export/access other details from Outlook to MS Excel. If your now thinking what will be the use of this code. The answer is very simple, you can take the snapshot of your inbox and know what was the age of particular email at that point of time. Also, you can maintain list of emails from where you receive emails and at times you receive data or table in Outlook which you want to export in MS Excel.
Remember, we are here to provide free MS Excel help and enhance the MS Excel knowledge of all the blog visitors

Sub exportemail1()
'Code is free to use
'Do not remove comments
'for any further help, please visit
http://findsarfaraz.blogspot.com
‘for email me
findsarfaraz@gmail.com
On Error Resume Next
Dim emailcount As Integer
Dim OLF As Outlook.MAPIFolder
Dim ol As New Outlook.Application
'OLF is declared as mapi folder to decide'which folder you want to target
Set OLF = ol.Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
'OLF.Items.Count provide the number of mail present in inbox
emailcount = OLF.Items.Count
'by i=1 we 'are initializing the variable by value 1'else it will throw an error
i = 1
'Here I am using do while - loop to'Browse through all mail
Do While i <= emailcount
Sheet3.Cells(i + 1, 1) = OLF.Items(i).SenderEmailAddress
Sheet3.Cells(i + 1, 2) = OLF.Items(i).SenderName
Sheet3.Cells(i + 1, 3) = OLF.Items(i).SentOn
i = i + 1
Loop
'Like SenderEmailAddress SenderName SentOn'we can use other properties of email to get other 'details
Set OLF = Nothing
Set ol = Nothing
End Sub

Though, this is only post so far. I will try my best to post more and more. Next, I am planning to post basic post on Vlookup, SUMIF and other basic function. For all these update you can subscribe via email.

Outlook to MS Excel Export Example download

We assure you knowledge, not SPAM!

6 comments:

ambardekarsuchita@gmail.com said...

hi,

i am suchita ambardekar.I am financial technical analyst.I have ablog of my own.I am a family friend of amita gadre.She gave me the link.Do u have any such site or blog for blog user like us.Who wamt to make professional blog and learn at the same time.

http://www.suchitaambardekar.blogspot.com

Sarfaraz Ahmed said...

Hello Suchita,

If I understand correctly you are looking for blog to learn in financial analysis domain and at the same time you want to create a professional blog.
So, far I have not need blogs with financial analysis. I will definitely send you some links. If you need further help with respect to create a blog. I will try to assist you.

Regards,
Sarfaraz Ahmed

Johan said...

I used some of your code in my program that communicates with Outlook!


http://vbaexcel.eu/vba-macro-code/email-sender-vba-outlook

Thanks!

Alex said...

Yesterday I had the big problem.All my mails were damaged and was dissapeared.But a friend call me and advised-fix microsoft outlook.To my surprise program helped me very easy.And I knew that it can saving the output data either as a single .pst file or as a set of .eml, .vcf and .txt files.Besides that tool helped me for free.

Hakimtea said...

Thanks ever so much, very useful article. If you do not mind, please visit my article related to travel to Pandeglang district in Banten, Indonesia at Kenali dan Kunjungi Objek Wisata di Pandeglang

Best regards

Alex said...

I often work with MS Excel,and once I renamed my xls file and something must have happened... I was disappeared,because all my data was damaged. My friend advised me - recovery excel 2007 files damaged. At the outset i thought that the tool was usual. But when I used it,I changed my mind. It solved my problem for minutes and without payment as far as I remember. As said my brother,the was found on a soft forum.

Post a Comment