Create folders in another mailbox

DKY

Joined
Sep 4, 2008
Messages
4
Reaction score
0
I found this code online which creates folders in the inbox but I'm trying to create folders in an inbox in another mailbox. I have a bunch of them to create so to do this programatically would be awesome! Thanks!

Code:
Public Sub psubSetUpFoldersInOutlook()
Dim oloUtlook As Outlook.Application
Dim ns As Outlook.NameSpace
Dim itm As Object

On Error Resume Next

Application.ScreenUpdating = False

Set oloUtlook = CreateObject("Outlook.Application")
Set ns = oloUtlook.GetNamespace("MAPI")
Set itm = ns.GetDefaultFolder(olFolderInbox)

itm.Folders.Add ("Name of Folder You want To add")

Set oloUtlook = Nothing
Set ns = Nothing
Set itm = Nothing

MsgBox "Outlook Set Up Succesfully"
ThisWorkbook.Close


End Sub
 
Back
Top