Solved

Outlook macro to display purlic folder from a toolbar button

Posted on 2009-04-09
6
452 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Learn more about how the humble email signature can be used as more than just an electronic business card. When used correctly, a signature can easily be tailored for different purposes by different departments within an organization.
Resolve DNS query failed errors for Exchange
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…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

757 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