VB add grandchild folder

  • Thread starter Thread starter isacp
  • Start date Start date
I

isacp

I have been searching for a while but to no avail. I would like to
write code that adds a folder into a subfolder in the inbox. i.e. In my
in box I have a folder called "distribute" I want to add folders with
vb to the "distribute" folder.

(how can I add a child to a child?)
 
Am 17 Oct 2006 14:42:14 -0700 schrieb (e-mail address removed):

It works like it does for the Inbox: Just call the folder´s Folders.Add
function.
 
I am very new to outlook.

is this something that should work?

Dim myOlApp As New Outlook.Application
Dim myOlFolders As Outlook.Folders

Public Sub fthsd()
Set myOlFolders =
myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Folders("distribute")


myOlFolders.FolderAdd "tes"
End Sub
 
Michael said:
Am 17 Oct 2006 14:42:14 -0700 schrieb (e-mail address removed):

It works like it does for the Inbox: Just call the folder´s Folders.Add
function.


Could you give me an example?
 
Am 18 Oct 2006 07:41:44 -0700 schrieb knowzero:

Yes, that works if the folder "distribute" exists already. (There´s just a
simple typo: It´s Folders.Add, not FolderAdd).

As long as you're in Outlook VBA, don´t try to create any new instance of
the Application object, instead use the instrinsic one:

Private myOlFolders As Outlook.Folders

Public Sub fthsd()
Set myOlFolders = Application.GetNamespace("MAPI") _
.GetDefaultFolder(olFolderInbox).Folders("distribute")
myOlFolders.Folders.Add "tes"
End Sub
 
Back
Top