Solved

Outlook macro to display purlic folder from a toolbar button

Posted on 2009-04-09
6
457 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

If you don't know how to downgrade, my instructions below should be helpful.
In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

730 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