Solved

How can I have Outlook 2007 open my Personal AND Internet Calendars as the default view (using VBA?)?

Posted on 2008-06-24
6
1,015 Views
Last Modified: 2010-04-21
I want all 10 computers (running XP and Vista) that are using Outlook 2007 to open as a default view to Personal Calendars AND any Internet Calendars that are currently being subscribed to.  By navigating to Tools--Options--Other--Advanced Options, you can choose the Startup folder (i.e. my personal calendar, or an internet calendar subscribed folder), but it will open only that calendar and leave any other calendars "unopened", or unchecked, needing to be checked in order to be viewed.  The internet calendar subscriptions then need to be manually checked on the left-hand navigation pane in order to view them with the personal calendar (currently set up to view in overlay mode, weekly).

One important thing to note in terms of a possible workaround is this:
If I check my personal calendar and my internet calendar subscriptions on the left-hand navigation pane, and change the "Startup in this folder" setting (Tools--Options--Other--Advanced Options) to "Inbox", and then restart
outlook, it will open the Inbox first (obviously).  But then when I click on the Calendar button/link in the navigation pane, all calendars (personal AND internet subscriptions) are still selected as a remembered setting from the previous session. So if I could tell Outlook to default open to the Inbox using the above method, and then have some sort of script that would switch to the calendars in the same way that clicking "Calendar" in the navigation pane, then this would solve my problem.

I have some limited experience with VB application development, and VBA in Excel, so if there is a simple script that I can run to accomplish this, some sort of loop that will check all calendars, something like that, I could handle that much.  Please point me to any information that will solve my problem, thanks!!
0
Comment
Question by:BullmanTech
  • 3
  • 2
6 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
Comment Utility
Hi, BullmanTech.

This should solve the problem.  It switches to the calendar folder and then opens whatever calendars you want to view.  Right now I have it set to open calendars 1, 4, and 8.  You can edit the code to open whatever calendars you want to open.  The calendar numbers correspond to their position in the list in the navigation pane.

Let me know if you need detailed instructions on how to use this code in Outlook.

Note to anyone viewing this question in the future: this solution only works in Outlook 2007.
Sub Jump2CalendarFolder()

    Dim v As Outlook.NavigationPane, _

        w As Outlook.NavigationModules, _

        x As Outlook.NavigationModule, _

        y As Outlook.NavigationGroups, _

        z As Outlook.NavigationGroup, _

        nf As Outlook.NavigationFolder, _

        intIndex As Integer

    Set Application.ActiveExplorer.CurrentFolder = Session.GetDefaultFolder(olFolderCalendar)

    DoEvents

    Set v = Application.ActiveExplorer.NavigationPane

    Set w = v.Modules

    Set x = w.GetNavigationModule(olModuleCalendar)

    Set y = x.NavigationGroups

    Set z = y.Item(1)

    For intIndex = 1 To z.NavigationFolders.Count

        Set nf = z.NavigationFolders.Item(intIndex)

        Select Case intIndex

            Case 1, 4, 8

                nf.IsSelected = True

            Case Else

                nf.IsSelected = False

        End Select

    Next

End Sub

Open in new window

0
 
LVL 5

Author Comment

by:BullmanTech
Comment Utility
Thanks so much for the code, I think it worked and accomplished exactly what I need.  The only thing is that I don't know how to get a Startup event to work in Outlook.  I just pasted your code in and then played around with the following code (I named another procedure Application_Startup and put a few simple Outlook actions in there to test it):

Public WithEvents Application_Startup() As Outlook.Application

I put that in as a class level statement, but I get an error message that says "Compile Error: Only valid in object module."  I have no idea what I'm doing (obviously) as I've mostly done VB in VS 2005 and a tiny bit of VBA in Excel.  I'm assuming that you can guide me to a solution easy enough.  Thanks again.
0
 
LVL 76

Assisted Solution

by:David Lee
David Lee earned 500 total points
Comment Utility
Application_Startup is an event.  It fires each time Outlook opens.  It cannot be declared like a variable.  You'll want something like the snippet below which has to go in the ThisOutlookSession module.  I'm not sure this'll work though.  Startup occurs before the interface appears.  I'm not sure Outlook will be initialized to the point that this will work.  No harm in trying though.
Public Sub Application_Startup()

    Jump2CalendarFolder

End Sub

Open in new window

0
 
LVL 5

Author Closing Comment

by:BullmanTech
Comment Utility
Thanks so much for the help, I'm 99% there.  The only thing left to do is figure out how to switch from the mail to the calendar!

Sean Bullman
BullmanTech
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
You're welcome.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Get an idea of what you should include in an email disclaimer with these Top 5 email disclaimer tips.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 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

10 Experts available now in Live!

Get 1:1 Help Now