how to select Navigation Pain in Outlook

E

Ed

How can I, through VBA, select which module is being displayed currently in
the Navigation Pane in Microsoft Outlook. For example, if if the Calender
module is displayed and I want to display the Folders List instead, what VBA
command would do that. (The NavigationPane.CurrentModule property is
read-only).

Also, when the Folders List is being displayed, how can I select which
folder is being displayed (i.e. active)? For example, if the Calendar is now
selected and I want to activate the Inbox, what code would do this? (To
clarify, to do this manually with the mouse, you'd just click on the Inbox
and it would shift the focus--that's what I want to do in VBA).

I'm using Outlook 2007.
 
J

Jie Wang [MSFT]

Hi Ed,

Try setting the Explorer object's CurrentFolder and see if that is what you
want.

You need to first get the corresponding Folder object and then set the
property, like:

Dim f As Folder
Dim myNamespace As Outlook.NameSpace

Set myNamespace = Application.GetNamespace("MAPI")
Set f = myNamespace.GetDefaultFolder(olFolderContacts)

Set Application.ActiveExplorer.CurrentFolder = f

Will switch the currently active Explorer to display the default contacts
folder.

And the following sample code will make the Explorer walk through all the
folders in the default Inbox (including Inbox folder itself):

Declare Sub Sleep Lib "kernel32.dll" (ByVal time As Long)

Sub Test()
GoThroughFolders Nothing
End Sub


Sub GoThroughFolders(ByVal f As Folder)

If f Is Nothing Then
Dim myNamespace As Outlook.NameSpace

Set myNamespace = Application.GetNamespace("MAPI")
Set f = myNamespace.GetDefaultFolder(olFolderInbox)
End If

Set Application.ActiveExplorer.CurrentFolder = f
Sleep 200
DoEvents

Dim i As Integer

For i = 1 To f.Folders.Count
GoThroughFolders f.Folders(i)
Next

End Sub

Hope this helps. If you have further questions regarding this topic, please
kindly let me know.

Thanks,

Jie Wang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jie Wang [MSFT]

Hi Ed,

Any updates on the issue?

If you still need assistance, please don't hesitate to let me know.

Thanks,

Jie Wang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top