PDA

View Full Version : Can someone help in creating multiple sub folders in outlook



Ckolawill
01-28-2013, 08:09 PM
I am looking for a script that will create sub folders in my inbox.
Basically the names should be
800
801
802
803
and so on till 899

skatonni
01-30-2013, 02:52 PM
Sub Add_Folders()
Dim objNameSpace As NameSpace
Dim objFolder As folder
Dim i As Long
Dim objNewFolder As folder
Set objNameSpace = Application.GetNamespace("MAPI")
Set objFolder = objNameSpace.GetDefaultFolder(olFolderInbox)
For i = 800 To 801
On Error Resume Next ' when the folder already exists
Set objNewFolder = objFolder.Folders.Add(i)
Next i
Set objNameSpace = Nothing
Set objFolder = Nothing
End Sub