How to stop iCloud calendars opening by default

Status
Not open for further replies.

chunkywizard

Member
Outlook version
Outlook 2007
Email Account
IMAP
Hi there,

I hope you can help me. I am a newbie to scripts in Outlook but have been doing a bit of reading. Bascially I have installed CodeTwo Sync for iCloud and now I have 2 active iCloud calendars everytime I boot. I wish only for my main calendar (My Calendars: Calendar) to be active on boot. Reading the forum it looks as though I can change this behaviour by using a script. I thought I should copy this: https://forums.slipstick.com/threads/90118-outlook-calendar-display/ but I can't get it to work. Can you help?

The steps I take are:

Alt F11

double click 'ThisOutlookSession'

pasted text below in

save

press play

(a box titled Macro comes up)

named macro and clicked create

press play

(a box titled macro comes up)

click run

nothing happens

I am running Outlook 2007 SP3 and have Macro security set to Warnings for All Macros

Just to confirm, the text I am pasting is:

Dim WithEvents objPane As NavigationPane


Private Sub Application_Startup()
Set objPane = Application.ActiveExplorer.NavigationPane


End Sub


Private Sub objPane_ModuleSwitch(ByVal CurrentModule As NavigationModule)
Dim objModule As ContactsModule
Dim objGroup As NavigationGroup
Dim objNavFolder As NavigationFolder

If CurrentModule.NavigationModuleType = olModuleContacts Then
Set objModule = objPane.Modules.GetNavigationModule(olModuleContacts)

' Use the Group name the folder is in
Set objGroup = objModule.NavigationGroups("My Calendars")

' Replace 4 with the index number of the folder you want to use
Set objNavFolder = objGroup.NavigationFolders.Item(1)
objNavFolder.IsSelected = True
End If
Set objNavFolder = Nothing
Set objGroup = Nothing
Set objModule = Nothing
End Sub

Any ideas what I am doing wrong (or what is wrong with the script)? Any help, gratefully appreciated,

Paul
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
If you want to remove the iCloud calendar you need deselect the iCloud calendars too - something like this -
Set objGroup = objModule.NavigationGroups("iCloud")
' Replace 4 with the index number of the folder you want to use
Set objNavFolder = objGroup.NavigationFolders.Item(1) ' first icloud calendar
objNavFolder.IsSelected = False

I'll need to test it with outlook 2007 to see if it is outlook or something you're overlooking.

one thing on these steps:

Alt F11
double click 'ThisOutlookSession'
pasted text below in
save
press play <== on this you need to click in Application_Startup and press Run (play icon)
 

chunkywizard

Member
Outlook version
Outlook 2007
Email Account
IMAP
Hi Diane,

thanks for coming back to me. So I tried your suggestion but I can't get it to work. I fear it's my incompetence rather than your advice. So my full script now is copied below. I am not sure if I replaced the right bit, or whether it was an addition rather than a substitution. In fact do I need all of this script if all I want to do is deselect the 2 iCloud calendars? I am afraid I just blindly copied the other example and don't really understand if all of it is needed. Anyway, it seems to do nothing, I do believe I clicked in Application Startup though (I changed the left of 2 drop-downs to Application and the right one defaulted to Start Up, is this right?)

Dim WithEvents objPane As NavigationPane


Private Sub Application_Startup()
Set objPane = Application.ActiveExplorer.NavigationPane


End Sub




Private Sub objPane_ModuleSwitch(ByVal CurrentModule As NavigationModule)
Dim objModule As ContactsModule
Dim objGroup As NavigationGroup
Dim objNavFolder As NavigationFolder

If CurrentModule.NavigationModuleType = olModuleContacts Then
Set objModule = objPane.Modules.GetNavigationModule(olModuleContacts)

' Use the Group name the folder is in
Set objGroup = objModule.NavigationGroups("iCloud")

' Replace 4 with the index number of the folder you want to use
Set objNavFolder = objGroup.NavigationFolders.Item(1)
objNavFolder.IsSelected = False
End If
Set objNavFolder = Nothing
Set objGroup = Nothing
Set objModule = Nothing
End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Oh, one error is it's looking at contacts, not calendar module. I didn't even notice that oops before. The automatic macro at http://www.slipstick.com/developer/code-samples/select-multiple-calendars-outlook/ works perfectly, and with multiple icloud calendars. It assumes you have 3 calendars selected - the one you want and the iCloud calendars (2 in my case). If you have more than 2, then and the numbers to the case line. When I remove the issidebyside line, the calendar opened in list view after the first time - it shouldn't matter true or false, since only one calendar is open. But if you want two open that can affect side by side or overlay.

[removed code see next message for new code]
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Hm. it worked a few times then stopped working. I removed the side by side line and its working again. The if statement checks to see if they are checked, so I'm not dropping to list view.

Code:
Dim WithEvents objPane As NavigationPane
 
 
Private Sub Application_Startup()
   Set objPane = Application.ActiveExplorer.NavigationPane
 
 
End Sub

 
 
Private Sub objPane_ModuleSwitch(ByVal CurrentModule As NavigationModule)
   Dim objPane As NavigationPane
   Dim objModule As CalendarModule
   Dim objGroup As NavigationGroup
   Dim objNavFolder As NavigationFolder
   Dim objCalendar As Folder
   Dim objFolder As Folder
   
   Dim i As Integer
   
   If CurrentModule.NavigationModuleType = olModuleCalendar Then
   Set Application.ActiveExplorer.CurrentFolder = Session.GetDefaultFolder(olFolderCalendar)
   DoEvents
   
   Set objCalendar = Session.GetDefaultFolder(olFolderCalendar)
   Set objPane = Application.ActiveExplorer.NavigationPane
   Set objModule = objPane.Modules.GetNavigationModule(olModuleCalendar)
   
   With objModule.NavigationGroups
       Set objGroup = .Item("iCloud")
   End With
   For i = 1 To objGroup.NavigationFolders.Count
       Set objNavFolder = objGroup.NavigationFolders.Item(i)
       Select Case i
       ' Enter the calendar index numbers you want to open
           Case 1, 2
            If objNavFolder.IsSelected = True Then
               objNavFolder.IsSelected = False
               'objNavFolder.IsSideBySide = False
            Else
            End If
            
       End Select
   Next
   End If

  Set objPane = Nothing
   Set objModule = Nothing
   Set objGroup = Nothing
   Set objNavFolder = Nothing
   Set objCalendar = Nothing
   Set objFolder = Nothing 
 
End Sub
 

chunkywizard

Member
Outlook version
Outlook 2007
Email Account
IMAP
Hi Diane,

thanks for your continued help, it's most appreciated. To update you, I think this is working now but there is a slight related glitch. When I start Outlook I get a Microsoft Office Outlook Security Notice for ThisOutlookSession. If I enable Macros everything seems to work. However when Outlook is restarted I get the pops up again.

My macro security is set to Warning for all macros.

Any ideas?

Paul
 

chunkywizard

Member
Outlook version
Outlook 2007
Email Account
IMAP
Hi Diane,

thanks for your continued help, it's most appreciated. To update you, I think this is working now but there is a slight related glitch. When I start Outlook I get a Microsoft Office Outlook Security Notice for ThisOutlookSession. If I enable Macros everything seems to work. However when Outlook is restarted I get the pops up again.

My macro security is set to Warning for all macros.

Any ideas?

Paul

Hi Diane,

I think you might have missed my question. I still get this issue and would like to get it sorted. Every time I start Outlook I get an Outlook Security Ntice stating "Microsoft Office has identified a potential security concern. ThisOutlookSession. Macos have been disabled etc. I need to click Enable Macros every time. Can you suggest what I need to do to make this disappear?

Regards

Paul
 

chunkywizard

Member
Outlook version
Outlook 2007
Email Account
IMAP
Hi Diane,

thanks for the reply. You'll be glad to hear I am now sorted, your advice worked a treat. Thanks very much for your help

CW
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
A How to stop user form from disapearing once mail window is closed? Outlook VBA and Custom Forms 0
D Outlook 2016 Outlook Error Msg "The operation cannot be performed ..." How to Stop it Using Outlook 3
T "Words In Recipient's Address" Rule Causes Outlook To Stop Processing Rules Using Outlook 3
Y Outlook 2013 Stop Outlook from automatically assigning categories to Tasks Using Outlook 0
D Any updates or fixes that would make this code stop working just moving emails to another folder Outlook VBA and Custom Forms 1
F Outlook 2016 call to Stop Timer Event Outlook VBA and Custom Forms 4
S stop calendar date reverting to today Using Outlook 7
B Contacts just stop syncing, yesterday... Using Outlook 4
O Stop more than one person responding to an email? Using Outlook 1
A Stop Rule (not turn off) that Delays Outgoing Items Outlook VBA and Custom Forms 1
A Can't stop Outlook.com from setting reminders on appointments? Using Outlook.com accounts in Outlook 3
D Stop meeting acceptance notifications Using Outlook 1
J it goes like outlook has stopped working, a problem caused the program to stop working correctly, wi Using Outlook 2
makinmyway Research Pane in Emails Turns on and Cut Paste Keys then Stop Working Using Outlook 5
J How to Stop OutLook from being Installed Using Outlook 1
A Exchange 2003 how to stop accepting EHLO and AUTH commands Exchange Server Administration 2
M Outlook 2010 IMAP rules occasionaly stop working Using Outlook 4
icacream outlook 2007 - how do I stop spacing when I hit return ? Using Outlook 4
T Outlook 2007 SSL selfsigned certificate how to stop security popup everytime? Using Outlook 10
Y How do you stop double booking? Using Outlook 1
Commodore Why some RSS feeds stop getting updates? Using Outlook 12
N Rules stop running automatically Using Outlook 10
S Stop mail checking Using Outlook 5
M Can you stop "Microsft Office Outlook is synchronizing folders"? Using Outlook 2
C stop messages to personal folders Using Outlook 2
M Why rules stop running automatically? Using Outlook 1
J Stop Outlook 2010 from showing face pictures in From/To/Cc/Subject box Using Outlook 2
S Shared Calendar Need To Stop Receiving Other Peoples Reminders Using Outlook 3
R Stop Double Booking Rooms Using Outlook 3
C stop facebook? Using Outlook 16
A How do I get Outlook to stop adding a "+1" in front of a telephone number that has an extension. Using Outlook 13
L Outlook inbox is "always in front". How to stop that? BCM (Business Contact Manager) 1
M Stop Search folders from disabling every 1-2 days? Outlook VBA and Custom Forms 3
N VBA Procedure (or Macro) to Stop Outlook from Closing? Outlook VBA and Custom Forms 2
M Stop ribbon item tool tip text from wrapping? Outlook VBA and Custom Forms 2
D Stop automatic opening BCM (Business Contact Manager) 1
C How to stop replies in thier tracks Outlook VBA and Custom Forms 1
A stop outlook reminders generated through BCM BCM (Business Contact Manager) 3
A iCloud add in problems Using Outlook 4
G Outlook 365 with iCloud account not syncing calendars Using Outlook 2
V Outlook 2016 Does Outlook-2016 (64 bit) work with iCloud for Windows ? Using Outlook 5
V Outlook 2016 Outlook-2016 and iCloud for Windows - Problems Using Outlook 9
B iCloud for Windows 11.2 disconnects by itself after 30-45 minutes Using Outlook 9
L icloud contacts sync Using Outlook 4
Commodore Outlook (2013) issues with icloud.com mail Using Outlook 0
D iCloud Add-in not working in Outlook 2013 and Outlook 2016 After Windows Upgrade & iCloud Upgrade Using Outlook 2
P Outlook tasks not syncing with iCloud Using Outlook 2
V iCloud calendar sync problems Using Outlook 13
M move to iCloud not working in outlook calendar Using Outlook 12
G icloud pictures not showing in Outlook 365 Using Outlook 0

Similar threads

Top