![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I am trying to create and name a personal folder. The code below will create
the folder and name the STORE or PST filename as I want, but I cannot seem to figure out how to name the personal folder after (or while) it has been created. It always shows up as "Personal Folders". Can someone point me in the right direction? I want the PST filename and the personal folder name to be the same. TIA... Mark Ivey __________________________________________________ _______________________________ Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function fOSUserName() As String ' Returns the network login name Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If (lngX 0) Then fOSUserName = Left$(strUserName, lngLen - 1) Else fOSUserName = vbNullString End If End Function Sub Test() On Error Resume Next Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem Dim myFolder As String Dim objUserName As String myFolder = Format(Date, "yyyy") Set objNS = Application.GetNamespace("MAPI") Set objInbox = objNS.GetDefaultFolder(olFolderInbox) Set objFolder = objNS.Folders(myFolder) objUserName = fOSUserName For Each objItem In Application.ActiveExplorer.Selection If objFolder Is Nothing Then objNS.AddStore "C:\Documents and Settings\" & objUserName & "\Local Settings\Application Data\Microsoft\Outlook\" & myFolder & ".pst" End If Next End Sub __________________________________________________ _______________________________ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to Sync Public Folder Contacts with Personal Folder Contact Li | Larz | Outlook - Using Contacts | 0 | May 14th 07 07:22 PM |
'Naming' a hyperlink | speedy_mike | Outlook Express | 10 | April 23rd 07 06:56 PM |
Outlook 2003 Calendar Naming/Properties | internetsdave | Outlook - General Queries | 1 | February 23rd 07 01:32 PM |
properly creating Personal Folders | RBB | Outlook - General Queries | 2 | February 11th 07 04:02 PM |
Naming distribution lists in Outlook | MAQ | Outlook - Using Contacts | 2 | October 16th 06 10:33 AM |