Solved

Outlook macro to display purlic folder from a toolbar button

Posted on 2009-04-09
6
459 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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

Industry Leaders: 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!

Question has a verified solution.

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

Mailbox Overload?
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
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…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

691 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