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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Compromised PC? 17 171
Indexing does not work window corrupt files window 7 25 87
vba excel2010 and 2013 2 37
Problem with Yahoo and Outlook SMTP Email 7 79
If you don't know how to downgrade, my instructions below should be helpful.
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
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…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

911 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

20 Experts available now in Live!

Get 1:1 Help Now