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,026 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
[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
  • 2
6 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 21911958
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
ID: 21922842
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
ID: 21927124
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
ID: 31470294
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
ID: 21927774
You're welcome.
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Outlook for mac 2011 21 53
outlook 365 3 58
Office 365: Hybrid Migration from Exchange (Retention Policies) 22 81
Kaspersky Virus Scan 5 21
Monitor input from a computer is usually nothing special.  In this instance it prevented anyone from using the computer.  This was a preconfiguration that didn't work.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

738 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