Vodkasoda
asked on
I need to point to my Personal Folders File in Outlook 2003
Hi, I am a Mainframe Programmer, but by no means an experienced VBA user, so whilst I can code the logic and processing, I have trouble with the pointers and setting up of variables, hopefully somebody can help me with this ...
I have the following VBA code that I used in an Outlook 2000 macro to access a specific personal folder which was just a sub-folder within INBOX :
Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFold erInbox)
Set SubFolder1 = Inbox.Folders("Gary")
Set SubFolder2 = SubFolder1.Folders("Kickab out")
Set SubFolder3 = SubFolder2.Folders("Attach ments")
This means I end up with SubFolder3 as the pointer to the folder I want to access.
In Outlook 2003, my folders are no longer sub-folders of INBOX, but are within a Personal Folders File "TheHeaths", though the sub-folders Gary/Kickabout/Attachments are the same ...
How do I amend/replace this code to work in Outlook 2003 please, to point directly at the Personal Foldefs File folder that I want to access ?!?
Any help much appreciated ...
I have the following VBA code that I used in an Outlook 2000 macro to access a specific personal folder which was just a sub-folder within INBOX :
Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFold
Set SubFolder1 = Inbox.Folders("Gary")
Set SubFolder2 = SubFolder1.Folders("Kickab
Set SubFolder3 = SubFolder2.Folders("Attach
This means I end up with SubFolder3 as the pointer to the folder I want to access.
In Outlook 2003, my folders are no longer sub-folders of INBOX, but are within a Personal Folders File "TheHeaths", though the sub-folders Gary/Kickabout/Attachments
How do I amend/replace this code to work in Outlook 2003 please, to point directly at the Personal Foldefs File folder that I want to access ?!?
Any help much appreciated ...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No, you don't have to use that code to get to one particular folder. The advantage of that code is that it will open ANY folder without having to change the code of the program. If you put that code in a module, then you can reference it from ANY bit of Outlook VBA code you use and not have to write a nested series of statements like
Set Inbox = ns.GetDefaultFolder(olFold erInbox)
Set SubFolder1 = Inbox.Folders("Gary")
Set SubFolder2 = SubFolder1.Folders("Kickab out")
Set SubFolder3 = SubFolder2.Folders("Attach ments")
every time you want to open some folder. Reusable code is the better appraoch.
Set Inbox = ns.GetDefaultFolder(olFold
Set SubFolder1 = Inbox.Folders("Gary")
Set SubFolder2 = SubFolder1.Folders("Kickab
Set SubFolder3 = SubFolder2.Folders("Attach
every time you want to open some folder. Reusable code is the better appraoch.
ASKER
Yes, point taken and I do agree, but I am writing this for a home project and I can't see that I'd need to do anything like this again ... however, having taken a closer look at what you've writtem, I've implemented it & it worked perfectly first time !!!
Cheers BlueDevilFan
Cheers BlueDevilFan
ASKER
Andy Pope at OzGrid has given me the following code, which points me to my Personal Folders File, though I am still trying to work out how to access the sub-folder itself !!!
Set olApp = CreateObject("Outlook.Appl
Set ns = olApp.GetNamespace("MAPI")
Set Inbox = ns.Folders("TheHeaths")