Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Extract All the Folders Name form Outlook (http://www.outlookbanter.com/outlook-vba/34057-extract-all-folders-name-form.html)

Vadhimoo November 29th 06 03:47 AM

Extract All the Folders Name form Outlook
 
Hi
We are having more than 2000 folders in our INBOX. We would like to extract
all the folders name to excel. How can we extract all the folders name..?

Thanks in advance for your reply.

Michael Bauer [MVP - Outlook] November 29th 06 07:15 AM

Extract All the Folders Name form Outlook
 

You already have code for extracting mails to Excel. What is your question
now?

BTW: I'd say, you urgently have to switch your system away from folders to
categories.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --

Am Tue, 28 Nov 2006 18:47:00 -0800 schrieb Vadhimoo:

Hi
We are having more than 2000 folders in our INBOX. We would like to

extract
all the folders name to excel. How can we extract all the folders name..?

Thanks in advance for your reply.


Vadhimoo November 29th 06 10:23 AM

Extract All the Folders Name form Outlook
 
Dear Michael,
Thanks.I know extract mails from INBOX. My question is in our INBOX having
more than 2000 sub folders. I want to extract all my sub folders name to
excel or access.
Like...
Inbox
USA2000
Newzeland2002
...........

"Michael Bauer [MVP - Outlook]" wrote:


You already have code for extracting mails to Excel. What is your question
now?

BTW: I'd say, you urgently have to switch your system away from folders to
categories.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --

Am Tue, 28 Nov 2006 18:47:00 -0800 schrieb Vadhimoo:

Hi
We are having more than 2000 folders in our INBOX. We would like to

extract
all the folders name to excel. How can we extract all the folders name..?

Thanks in advance for your reply.



Sue Mosher [MVP-Outlook] November 30th 06 05:15 PM

Extract All the Folders Name form Outlook
 
This Outlook VBA sample code (from my forthcoming Outlook 2007 programming book recurses the entire folder hierarchy to build a string (mstrList) of all the folders along with the number of items in each one.

Dim mlngItemCount As Long

Dim mlngFolderCount As Long

Dim mstrList As String



Sub ListAllFolders()

Dim objOL As Outlook.Application

Dim objNS As Outlook.NameSpace

Dim objFolder As Outlook.Folder

Dim objMsg As Outlook.MailItem

mlngItemCount = 0

mlngFolderCount = 0

mstrList = ""

Set objOL = Application

Set objNS = objOL.Session

For Each objFolder In objNS.Folders

Call ProcessFolder(objFolder)

mstrList = mstrList & vbCrLf

Next

Set objMsg = objOL.CreateItem(olMailItem)

mstrList = mstrList & vbCrLf & _

"Total folders in Outlook = " & _

Format(mlngFolderCount, "###,###") & _

vbCrLf & "Total items in Outlook = " & _

Format(mlngItemCount, "###,###")

objMsg.Body = mstrList

objMsg.Display

Set objOL = Nothing

Set objNS = Nothing

Set objFolder = Nothing

End Sub



Sub ProcessFolder(startFolder As Outlook.Folder)

Dim objFolder As Outlook.Folder

On Error Resume Next

mstrList = mstrList & vbCrLf & startFolder.FolderPath & _

vbTab & startFolder.Items.Count

mlngItemCount = mlngItemCount + startFolder.Items.Count

mlngFolderCount = mlngFolderCount + 1

For Each objFolder In startFolder.Folders

Call ProcessFolder(objFolder)

Next

Set objFolder = Nothing

End Sub


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Vadhimoo" wrote in message ...
Hi
We are having more than 2000 folders in our INBOX. We would like to extract
all the folders name to excel. How can we extract all the folders name..?

Thanks in advance for your reply.


Michael Bauer [MVP - Outlook] December 1st 06 07:37 AM

Extract All the Folders Name form Outlook
 


So your question is not how to write data into Excel, but how to read
Outlook's folder hierarchy. Please see Sue's answer. I'd maybe have answered
the Excel part - and wasted my time :-)

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --

Am Wed, 29 Nov 2006 01:23:03 -0800 schrieb Vadhimoo:

Dear Michael,
Thanks.I know extract mails from INBOX. My question is in our INBOX having
more than 2000 sub folders. I want to extract all my sub folders name to
excel or access.
Like...
Inbox
USA2000
Newzeland2002
...........

"Michael Bauer [MVP - Outlook]" wrote:


You already have code for extracting mails to Excel. What is your

question
now?

BTW: I'd say, you urgently have to switch your system away from folders

to
categories.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --

Am Tue, 28 Nov 2006 18:47:00 -0800 schrieb Vadhimoo:

Hi
We are having more than 2000 folders in our INBOX. We would like to

extract
all the folders name to excel. How can we extract all the folders

name..?

Thanks in advance for your reply.



Vadhimoo December 5th 06 09:39 AM

Extract All the Folders Name form Outlook
 
Dear Sue Mosher,
Good Morning , Thanks for your response.When i run the below code.
I got the Compile Error.
For this line: Sub ProcessFolder(startFolder As Outlook.Folder)
Error is: Used-defined type not defined.
I am using Microsoft Outlook 2003.Please assist me.Have a nice day.


Dear Michael Bauer,
We cant able to view the "Thread " Answer for the last three days.I sent a
mail to microsoft helpdesk at ". Today only we view
this thread.

Have a nice day.

Thanks and Regards,
Vadhimoo.

"Sue Mosher [MVP-Outlook]" wrote:

This Outlook VBA sample code (from my forthcoming Outlook 2007 programming book recurses the entire folder hierarchy to build a string (mstrList) of all the folders along with the number of items in each one.

Dim mlngItemCount As Long

Dim mlngFolderCount As Long

Dim mstrList As String



Sub ListAllFolders()

Dim objOL As Outlook.Application

Dim objNS As Outlook.NameSpace

Dim objFolder As Outlook.Folder

Dim objMsg As Outlook.MailItem

mlngItemCount = 0

mlngFolderCount = 0

mstrList = ""

Set objOL = Application

Set objNS = objOL.Session

For Each objFolder In objNS.Folders

Call ProcessFolder(objFolder)

mstrList = mstrList & vbCrLf

Next

Set objMsg = objOL.CreateItem(olMailItem)

mstrList = mstrList & vbCrLf & _

"Total folders in Outlook = " & _

Format(mlngFolderCount, "###,###") & _

vbCrLf & "Total items in Outlook = " & _

Format(mlngItemCount, "###,###")

objMsg.Body = mstrList

objMsg.Display

Set objOL = Nothing

Set objNS = Nothing

Set objFolder = Nothing

End Sub



Sub ProcessFolder(startFolder As Outlook.Folder)

Dim objFolder As Outlook.Folder

On Error Resume Next

mstrList = mstrList & vbCrLf & startFolder.FolderPath & _

vbTab & startFolder.Items.Count

mlngItemCount = mlngItemCount + startFolder.Items.Count

mlngFolderCount = mlngFolderCount + 1

For Each objFolder In startFolder.Folders

Call ProcessFolder(objFolder)

Next

Set objFolder = Nothing

End Sub


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Vadhimoo" wrote in message ...
Hi
We are having more than 2000 folders in our INBOX. We would like to extract
all the folders name to excel. How can we extract all the folders name..?

Thanks in advance for your reply.



Michael Bauer [MVP - Outlook] December 5th 06 12:51 PM

Extract All the Folders Name form Outlook
 

Vadhimoo, the declaration of:

startFolder as Outlook.Folder

is for OL 2007. For earlier versions it's

startFolder as Outlook.Mapifolder

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


Am Tue, 5 Dec 2006 00:39:37 -0800 schrieb Vadhimoo:

Dear Sue Mosher,
Good Morning , Thanks for your response.When i run the below code.
I got the Compile Error.
For this line: Sub ProcessFolder(startFolder As Outlook.Folder)
Error is: Used-defined type not defined.
I am using Microsoft Outlook 2003.Please assist me.Have a nice day.


Dear Michael Bauer,
We cant able to view the "Thread " Answer for the last three days.I sent a
mail to microsoft helpdesk at ". Today only we view
this thread.

Have a nice day.

Thanks and Regards,
Vadhimoo.

"Sue Mosher [MVP-Outlook]" wrote:

This Outlook VBA sample code (from my forthcoming Outlook 2007

programming book recurses the entire folder hierarchy to build a string
(mstrList) of all the folders along with the number of items in each one.

Dim mlngItemCount As Long

Dim mlngFolderCount As Long

Dim mstrList As String



Sub ListAllFolders()

Dim objOL As Outlook.Application

Dim objNS As Outlook.NameSpace

Dim objFolder As Outlook.Folder

Dim objMsg As Outlook.MailItem

mlngItemCount = 0

mlngFolderCount = 0

mstrList = ""

Set objOL = Application

Set objNS = objOL.Session

For Each objFolder In objNS.Folders

Call ProcessFolder(objFolder)

mstrList = mstrList & vbCrLf

Next

Set objMsg = objOL.CreateItem(olMailItem)

mstrList = mstrList & vbCrLf & _

"Total folders in Outlook = " & _

Format(mlngFolderCount, "###,###") & _

vbCrLf & "Total items in Outlook = " & _

Format(mlngItemCount, "###,###")

objMsg.Body = mstrList

objMsg.Display

Set objOL = Nothing

Set objNS = Nothing

Set objFolder = Nothing

End Sub



Sub ProcessFolder(startFolder As Outlook.Folder)

Dim objFolder As Outlook.Folder

On Error Resume Next

mstrList = mstrList & vbCrLf & startFolder.FolderPath & _

vbTab & startFolder.Items.Count

mlngItemCount = mlngItemCount + startFolder.Items.Count

mlngFolderCount = mlngFolderCount + 1

For Each objFolder In startFolder.Folders

Call ProcessFolder(objFolder)

Next

Set objFolder = Nothing

End Sub


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Vadhimoo" wrote in message

...
Hi
We are having more than 2000 folders in our INBOX. We would like to

extract
all the folders name to excel. How can we extract all the folders

name..?

Thanks in advance for your reply.



Sue Mosher [MVP-Outlook] December 5th 06 02:29 PM

Extract All the Folders Name form Outlook
 
Sorry about that. GOod catch, Michael.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Michael Bauer [MVP - Outlook]" wrote in message .. .

Vadhimoo, the declaration of:

startFolder as Outlook.Folder

is for OL 2007. For earlier versions it's

startFolder as Outlook.Mapifolder

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


Am Tue, 5 Dec 2006 00:39:37 -0800 schrieb Vadhimoo:

Dear Sue Mosher,
Good Morning , Thanks for your response.When i run the below code.
I got the Compile Error.
For this line: Sub ProcessFolder(startFolder As Outlook.Folder)
Error is: Used-defined type not defined.
I am using Microsoft Outlook 2003.Please assist me.Have a nice day.


Dear Michael Bauer,
We cant able to view the "Thread " Answer for the last three days.I sent a
mail to microsoft helpdesk at ". Today only we view
this thread.

Have a nice day.

Thanks and Regards,
Vadhimoo.

"Sue Mosher [MVP-Outlook]" wrote:

This Outlook VBA sample code (from my forthcoming Outlook 2007

programming book recurses the entire folder hierarchy to build a string
(mstrList) of all the folders along with the number of items in each one.

Dim mlngItemCount As Long

Dim mlngFolderCount As Long

Dim mstrList As String



Sub ListAllFolders()

Dim objOL As Outlook.Application

Dim objNS As Outlook.NameSpace

Dim objFolder As Outlook.Folder

Dim objMsg As Outlook.MailItem

mlngItemCount = 0

mlngFolderCount = 0

mstrList = ""

Set objOL = Application

Set objNS = objOL.Session

For Each objFolder In objNS.Folders

Call ProcessFolder(objFolder)

mstrList = mstrList & vbCrLf

Next

Set objMsg = objOL.CreateItem(olMailItem)

mstrList = mstrList & vbCrLf & _

"Total folders in Outlook = " & _

Format(mlngFolderCount, "###,###") & _

vbCrLf & "Total items in Outlook = " & _

Format(mlngItemCount, "###,###")

objMsg.Body = mstrList

objMsg.Display

Set objOL = Nothing

Set objNS = Nothing

Set objFolder = Nothing

End Sub



Sub ProcessFolder(startFolder As Outlook.Folder)

Dim objFolder As Outlook.Folder

On Error Resume Next

mstrList = mstrList & vbCrLf & startFolder.FolderPath & _

vbTab & startFolder.Items.Count

mlngItemCount = mlngItemCount + startFolder.Items.Count

mlngFolderCount = mlngFolderCount + 1

For Each objFolder In startFolder.Folders

Call ProcessFolder(objFolder)

Next

Set objFolder = Nothing

End Sub


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Vadhimoo" wrote in message

...
Hi
We are having more than 2000 folders in our INBOX. We would like to

extract
all the folders name to excel. How can we extract all the folders

name..?

Thanks in advance for your reply.


Michael Bauer [MVP - Outlook] December 6th 06 07:20 AM

Extract All the Folders Name form Outlook
 

That's easy as I'm still living in the "old world" :-)


--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --

Am Tue, 5 Dec 2006 08:29:26 -0500 schrieb Sue Mosher [MVP-Outlook]:

Sorry about that. GOod catch, Michael.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Michael Bauer [MVP - Outlook]" wrote in message

.. .

Vadhimoo, the declaration of:

startFolder as Outlook.Folder

is for OL 2007. For earlier versions it's

startFolder as Outlook.Mapifolder

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


Am Tue, 5 Dec 2006 00:39:37 -0800 schrieb Vadhimoo:

Dear Sue Mosher,
Good Morning , Thanks for your response.When i run the below code.
I got the Compile Error.
For this line: Sub ProcessFolder(startFolder As Outlook.Folder)
Error is: Used-defined type not defined.
I am using Microsoft Outlook 2003.Please assist me.Have a nice day.


Dear Michael Bauer,
We cant able to view the "Thread " Answer for the last three days.I sent

a
mail to microsoft helpdesk at ". Today only we

view
this thread.

Have a nice day.

Thanks and Regards,
Vadhimoo.

"Sue Mosher [MVP-Outlook]" wrote:

This Outlook VBA sample code (from my forthcoming Outlook 2007

programming book recurses the entire folder hierarchy to build a string
(mstrList) of all the folders along with the number of items in each one.

Dim mlngItemCount As Long

Dim mlngFolderCount As Long

Dim mstrList As String



Sub ListAllFolders()

Dim objOL As Outlook.Application

Dim objNS As Outlook.NameSpace

Dim objFolder As Outlook.Folder

Dim objMsg As Outlook.MailItem

mlngItemCount = 0

mlngFolderCount = 0

mstrList = ""

Set objOL = Application

Set objNS = objOL.Session

For Each objFolder In objNS.Folders

Call ProcessFolder(objFolder)

mstrList = mstrList & vbCrLf

Next

Set objMsg = objOL.CreateItem(olMailItem)

mstrList = mstrList & vbCrLf & _

"Total folders in Outlook = " & _

Format(mlngFolderCount, "###,###") & _

vbCrLf & "Total items in Outlook = " & _

Format(mlngItemCount, "###,###")

objMsg.Body = mstrList

objMsg.Display

Set objOL = Nothing

Set objNS = Nothing

Set objFolder = Nothing

End Sub



Sub ProcessFolder(startFolder As Outlook.Folder)

Dim objFolder As Outlook.Folder

On Error Resume Next

mstrList = mstrList & vbCrLf & startFolder.FolderPath & _

vbTab & startFolder.Items.Count

mlngItemCount = mlngItemCount + startFolder.Items.Count

mlngFolderCount = mlngFolderCount + 1

For Each objFolder In startFolder.Folders

Call ProcessFolder(objFolder)

Next

Set objFolder = Nothing

End Sub


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Vadhimoo" wrote in message

...
Hi
We are having more than 2000 folders in our INBOX. We would like to

extract
all the folders name to excel. How can we extract all the folders

name..?

Thanks in advance for your reply.


Vadhimoo December 6th 06 02:26 PM

Extract All the Folders Name form Outlook
 
Dear Sue Mosher/Michael Bauer,

I changed as Outlook.MAPIfolder and run the code.I was waiting for around
three hours,in order to get the result of this macro.Then i debugged and
found ,it starts from" Public Folders". Please find my Puplic folders Tree:

Puplic Folders
All Public Folders
Suppliers
AT&T
MCI
.....
...... (1500 Suppliers , Each folder having atleast 10,000
mails)
Customers
Orange
Tele2UK
.........
.........(Around 1000 Customers, Each folder having atleast
10,000 mails)

Huge Folders-Is it may be the reason?
can you do one favor for me ?
Instead of extract Public folders name, i want to extract my Mailbox Folders
name:
Ex:
Mailbox - Vadhimoo
Drafts
Inbox
Legault
L2002
L2000
Eric
E2002
E2000
Analyse
Reseach2000
Research2002
Journal
Notes
Test2000
Test2002

Thanks and Regards,
Vadhimoo.


"Michael Bauer [MVP - Outlook]" wrote:


That's easy as I'm still living in the "old world" :-)


--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --

Am Tue, 5 Dec 2006 08:29:26 -0500 schrieb Sue Mosher [MVP-Outlook]:

Sorry about that. GOod catch, Michael.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Michael Bauer [MVP - Outlook]" wrote in message

.. .

Vadhimoo, the declaration of:

startFolder as Outlook.Folder

is for OL 2007. For earlier versions it's

startFolder as Outlook.Mapifolder

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


Am Tue, 5 Dec 2006 00:39:37 -0800 schrieb Vadhimoo:

Dear Sue Mosher,
Good Morning , Thanks for your response.When i run the below code.
I got the Compile Error.
For this line: Sub ProcessFolder(startFolder As Outlook.Folder)
Error is: Used-defined type not defined.
I am using Microsoft Outlook 2003.Please assist me.Have a nice day.


Dear Michael Bauer,
We cant able to view the "Thread " Answer for the last three days.I sent

a
mail to microsoft helpdesk at ". Today only we

view
this thread.

Have a nice day.

Thanks and Regards,
Vadhimoo.

"Sue Mosher [MVP-Outlook]" wrote:

This Outlook VBA sample code (from my forthcoming Outlook 2007
programming book recurses the entire folder hierarchy to build a string
(mstrList) of all the folders along with the number of items in each one.

Dim mlngItemCount As Long

Dim mlngFolderCount As Long

Dim mstrList As String



Sub ListAllFolders()

Dim objOL As Outlook.Application

Dim objNS As Outlook.NameSpace

Dim objFolder As Outlook.Folder

Dim objMsg As Outlook.MailItem

mlngItemCount = 0

mlngFolderCount = 0

mstrList = ""

Set objOL = Application

Set objNS = objOL.Session

For Each objFolder In objNS.Folders

Call ProcessFolder(objFolder)

mstrList = mstrList & vbCrLf

Next

Set objMsg = objOL.CreateItem(olMailItem)

mstrList = mstrList & vbCrLf & _

"Total folders in Outlook = " & _

Format(mlngFolderCount, "###,###") & _

vbCrLf & "Total items in Outlook = " & _

Format(mlngItemCount, "###,###")

objMsg.Body = mstrList

objMsg.Display

Set objOL = Nothing

Set objNS = Nothing

Set objFolder = Nothing

End Sub



Sub ProcessFolder(startFolder As Outlook.Folder)

Dim objFolder As Outlook.Folder

On Error Resume Next

mstrList = mstrList & vbCrLf & startFolder.FolderPath & _

vbTab & startFolder.Items.Count

mlngItemCount = mlngItemCount + startFolder.Items.Count

mlngFolderCount = mlngFolderCount + 1

For Each objFolder In startFolder.Folders

Call ProcessFolder(objFolder)

Next

Set objFolder = Nothing

End Sub


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Vadhimoo" wrote in message
...
Hi
We are having more than 2000 folders in our INBOX. We would like to
extract
all the folders name to excel. How can we extract all the folders
name..?

Thanks in advance for your reply.




All times are GMT +1. The time now is 12:58 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com