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

access different folder



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 12th 07, 04:51 PM posted to microsoft.public.outlook.program_vba
Tamar
external usenet poster
 
Posts: 1
Default access different folder

Hi,

I already know excel VBA but I am trying to programmically access Outlook
from Excel. I have a few questions:

i managed to access my main inbox that on this location:

personal folders Inbox

how do i access in VBA another folder that's on the same level as "personal
folders". for example, the archive folders or another main folder i created
on that level.

do give you an idea what i mean, this would be the xml-style structu

personal folders
folder x
inbox
/personal folders

main folder
folder i would like to access
folder 1
/main folder


- how do i send email from another account than the standard email account?

on www.outlookcode.com i found a book that might help me. Is it usefull? I
use office 2003 so i would rather have a book on outlook 2003 vba
exclusively. Is there such a book or is the book on outlookcode (2002
version) the onlye available book?

kind regards,

Tamar

  #2  
Old June 12th 07, 06:36 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default access different folder

Every .pst or top-level store in Outlook is also an entry in the top-level
folders collection that you can retrieve from NameSpace.Folders. So to get
your "Personal Folders" store, you'd call:

Dim objNS As Namespace
Dim objMyFolders As Folders
Dim objMyTopLevelFolder As MAPIFolder

Set objNS = Application.GetNamespace("MAPI")
Set objMyFolders = objNS.Folders("Personal Folders")
Set objMyTopLevelFolder = objMyFolders("Inbox")

As for choosing the e-mail account to send the message with, there is no
point checking to see if an account hasn't been chosen because the default
account is always used if no other account is selected. The only way to
programmatically set the sending account is to get a reference to the menu
item and call it's Execute method (however, you need to know the name or
ordinal position of the account name in the menu):

Sub ChangeSendingAccount()
Dim objCBPU As Office.CommandBarPopup
Dim objCBB As Office.CommandBarButton

Set objCBPU = ActiveInspector.CommandBars.FindControl(, 31224) 'get
Accounts button on Standard toolbar

'Get menu item by name or index number
Set objCBB = objCBPU.Controls.Item("&1 Microsoft Exchange Server")
'Set objCBB = objCBPU.Controls.Item(2)

objCBB.Execute

Set objCBPU = Nothing
Set objCBB = Nothing
End Sub

And yes, that book on Outlookcode.com is the best for you, and is applicable
for programming with Outlook 2000-2003.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Tamar" wrote:

Hi,

I already know excel VBA but I am trying to programmically access Outlook
from Excel. I have a few questions:

i managed to access my main inbox that on this location:

personal folders Inbox

how do i access in VBA another folder that's on the same level as "personal
folders". for example, the archive folders or another main folder i created
on that level.

do give you an idea what i mean, this would be the xml-style structu

personal folders
folder x
inbox
/personal folders

main folder
folder i would like to access
folder 1
/main folder


- how do i send email from another account than the standard email account?

on www.outlookcode.com i found a book that might help me. Is it usefull? I
use office 2003 so i would rather have a book on outlook 2003 vba
exclusively. Is there such a book or is the book on outlookcode (2002
version) the onlye available book?

kind regards,

Tamar

 




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
Access to OST folder when online Meex Outlook and VBA 1 March 8th 07 02:38 PM
How to know if can I access a folder ? Gianluigi Rubino Outlook and VBA 1 September 1st 06 07:23 PM
"Unable to display the folder. Microsoft Outlook could not access the specified folder location." jw Outlook - General Queries 0 July 21st 06 04:41 PM
"Unable to display the folder. Microsoft Outlook could not access the specified folder location." jw Outlook - Calandaring 0 July 21st 06 04:40 PM
"Unable to display the folder. Microsoft Outlook could not access the specified folder location." jw Outlook - Installation 0 July 21st 06 04:40 PM


All times are GMT +1. The time now is 07:06 AM.


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.