A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Macro to create folder in PST file



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old December 30th 09, 11:39 PM posted to microsoft.public.outlook.program_vba
Jen[_3_]
external usenet poster
 
Posts: 3
Default Macro to create folder in PST file

I have leveraged a macro I found online to create a new folder
underneath the default Inbox, with a name entered by the user.

However, what I REALLY want is to create the new folder under a folder
that lives in another PST.

So instead of:

Mailbox
--Inbox
----New Folder
Users PST
--Project

I want it to be created as follows:

Mailbox
--Inbox

Users PST
--Project
----New Folder

Here is the code I have so far - can anyone help?

Dim myolApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim myNewFolder As Outlook.MAPIFolder

Dim newProjectName As String
newProjectName = InputBox(Prompt:="You name please.", _
Title:="ENTER YOUR NAME", Default:="ENTRY")

Set myolApp = CreateObject("Outlook.Application")
Set myNamespace = myolApp.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox)


Set myNewFolder = myFolder.Folders.Add(newProjectName)
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
create Macro, Outlook 2007 - create is grayed out Dave Horne[_2_] Outlook - General Queries 2 November 4th 07 09:45 AM
Macro to extract subject and sender name of messages in folder to Excel file bony_tony Outlook and VBA 0 March 7th 07 01:16 AM
How do I create a macro to email a file Roger Outlook and VBA 1 October 24th 06 06:20 PM
create macro to show file size in outlook john mcmichael Outlook and VBA 3 May 2nd 06 09:55 PM


All times are GMT +1. The time now is 03:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.