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,028 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many people use more than one email account and so it becomes difficult for them to manage them when they use separate accounts,  so, in this article, I have shared an easy way to add Other Mail Accounts in your Google Inbox. It helps to combine all…
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
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: …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

628 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