Solved

Outlook macro to display purlic folder from a toolbar button

Posted on 2009-04-09
6
453 Views
Last Modified: 2012-05-06
I would like to create a macro to open a public calendar from a toolbar button. The calendar is located at:

\\Public Folders\All Public Folders\Penn_Machine_Company\_Public Calendar

I thought about making a shortcut but the shortcuts in Outlook 2007 can't be moved to the toolbar.

Thanks
0
Comment
Question by:alank2
  • 3
  • 3
6 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 24109556
Hi, alank2.

This should do it.
Sub OpenPublicFolder()

    Dim olkFolder As Outlook.Folder

    Set olkFolder = Outlook.Session.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Penn_Machine_Company").Folders("_Public Calendar")

    olkFolder.Display

    Set olkFolder = Nothing

End Sub

Open in new window

0
 

Author Comment

by:alank2
ID: 24109705
BlueDevilFan,

I figured you would get this. I forgot to add the full path to the calendar, so I changed the line to:

Set olkFolder = Outlook.Session.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Penn_Machine_Company").Folders("_Public Calendar").Folders("Calendar")

It works fine, however a second Outlook appears with the calendar. Is it possible to click run the macro so that the Outlook just switches to the calendar?

Thanks

0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 24109758
You're welcome.  This version opens the folder in the existing Outlook window.
Sub OpenPublicFolder()

    Dim olkFolder As Outlook.Folder

    Set olkFolder = Outlook.Session.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Penn_Machine_Company").Folders("_Public Calendar").Folders("Calendar")

    Set Outlook.Application.ActiveExplorer.CurrentFolder = olkFolder

    Set olkFolder = Nothing

End Sub

Open in new window

0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 

Author Comment

by:alank2
ID: 24109810
Works great,
Thanks again.
0
 

Author Closing Comment

by:alank2
ID: 31568630
Always the best
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24109880
Thanks.  Always happy to be of assistance.  Cheers!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now