PDA

Click to See Complete Forum and Search --> : adding a folder in outlook


seec77
Apr 20th, 2003, 12:36 PM
how can i add a folder in outlook? in know that i have to do something like this:

Application.Namespace("Something").Folders.Add "FolderName"

but i don't know what i have to write instead of Something...

RobDog888
Apr 21st, 2003, 01:43 AM
Here is how to create a new folder under the Inbox folder.
Private Function CreateFolder()

'oApp - only if Outlook is not running. Otherwise use 'Application'
Dim oApp = New Outlook.Application

Dim oNS As Outlook.NameSpace
Dim oInbox As Outlook.MAPIFolder
Dim oNewFolder As Outlook.MAPIFolder

'Use only one - oApp or Application. See first comment.
'Connection object.
Set oNS = oApp.GetNamespace("MAPI")
Set oNS = Application.GetNamespace("MAPI")

'Connection to Inbox folder.
Set oInbox = oNS.GetDefaultFolder(olFolderInbox)
'Create new subfolder "NewFolder"
Set oNewFolder = oInbox.Folders.Add("NewFolder", olFolderInbox)

End Function

seec77
Apr 22nd, 2003, 03:12 PM
cool, how much trouble to add a folder!
thanks man!

RobDog888
Apr 22nd, 2003, 03:18 PM
Your welcome.
Just drill down the folder path to where ever you want to create
a folder. Even if its under the Public folders.