Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Outlook Personal Folder

Status
Not open for further replies.

HenryAnthony

Technical User
Feb 14, 2001
358
US
Hi,

I am looking for a way in Access to create a personal folder in Outlook. I can create folders in the Outlook default folders but can't find any information on how to refer to the personal folders in code.

Here is what I am using to create folders in default Outlook folders:

Private Sub Command142_Click()
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim myNewFolder As Outlook.MAPIFolder
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myNewFolder = myFolder.Folders.Add("myFolder")
End Sub

Any help is greatly appreciated.

Thank you,

Henry
 
Below is some sample code of something I did a long time ago. I replaced your variable names appropriately. This sets a folder to the Call report Pulic folder.

Code:
Set myFolder = myNameSpace.Folders("Public Folders").Folders("All Public Folders").Folders("Call Report")

You should be able to start at the top with your personal folder and nest down to your appropriate folder.
 
Hi lameid,

Thanks for your post but I cannot get this to work with public folders. I am using the Add method to create the folder. This method does not support public folders as far as I know.

I appreciate your help!!!

Henry
 
try creating the folder in the default folders and moving it to personal folders
Code:
dim destfolder as Outlook.MAPIFolder
myNewFolder Save
set destfolder = myNameSpace.Folders("Personal Folders").Folders("Inbox").Folders("xxxx")
myNewFolder .Move destfolder
 
I will check that out. I won't be able to work on this any further until next week. I'll respond then and let you know how it's going.

Thanks!
 
Odd, I didn't see e-mail notifications for this thread.

I'm sorry I didn't read your OP close enough. You want to create a personal folder... Do you mean you want to add a folder in an existing personal folder file? If not, I'm not sure how you would go about adding a data file to Outlook. Anyway to add a subfolder, use the add method on the folders collection.

Code:
'Adds the sub Folder Fred under the folder myFolder
myFolder.Folders.Add "Fred"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top