Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / December 2005

Tip: Looking for answers? Try searching our database.

Open Calendar via MS Access 2003 form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
StuJol - 27 Dec 2005 08:42 GMT
Does anyone know any code i can use please to open the outlook
calendar via a command button on a microsoft access from?
Ken Slovak - [MVP - Outlook] - 27 Dec 2005 14:35 GMT
Do you mean to open Outlook and display the default Calendar folder?

Sub ShowCalendar()
   Dim oOL As Outlook.Application
   Dim oNS As Outlook.NameSpace
   Dim oExplorer As Outlook.Explorer
   Dim oFolder As Outlook.MAPIFolder

   Set oOL = CreateObject("Outlook.Application")

   Set oNS = oOL.GetNameSpace("MAPI")
   oNS.Logon

   Set oFolder = oNS.GetDefaultFolder(olFolderCalendar)
   If oNS.Explorers.Count = 0 Then
       Set oExplorer = oNS.Explorers.Add(oFolder)
   Else
       Set oExplorer = oOL.ActiveExplorer
       Set oExplorer.CurrentFolder = oFolder
   End If

   oFolder.Display

End Sub

There's no error trapping there and you need to set all objects = Nothing at
the end of the Sub but that should give you the idea.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> Does anyone know any code i can use please to open the outlook
> calendar via a command button on a microsoft access from?
StuJol - 27 Dec 2005 16:42 GMT
When i run your code from my cmd button i get this error msg "RunTime Error
438, Object doesnt support this property or method" and code breaks at If
oNS.Explorers.Count = 0 Then

> Do you mean to open Outlook and display the default Calendar folder?
>
[quoted text clipped - 26 lines]
> > Does anyone know any code i can use please to open the outlook
> > calendar via a command button on a microsoft access from?
Ken Slovak - [MVP - Outlook] - 28 Dec 2005 17:00 GMT
That'll teach me to write code on the fly. Sorry about that.

Use oOL.Explorers.Count and oOL.Explorers.Add.

The Explorers collection is exposed by the Application object, not the
NameSpace object.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> When i run your code from my cmd button i get this error msg "RunTime
> Error
> 438, Object doesnt support this property or method" and code breaks at If
> oNS.Explorers.Count = 0 Then
StuJol - 28 Dec 2005 19:06 GMT
Many Many thanks, you've solved something i've been trying to do for ages.
Once gain thanks.

One other thing, if you dont mind. The calendar opens as a small window in
the middel of my screen, do you know how to open it maximised?? i tried
DoCmd.Maximize at the end of the code but it maximises my form, not the
calendar

All the best for the new year

> That'll teach me to write code on the fly. Sorry about that.
>
[quoted text clipped - 7 lines]
> > 438, Object doesnt support this property or method" and code breaks at If
> > oNS.Explorers.Count = 0 Then
Ken Slovak - [MVP - Outlook] - 29 Dec 2005 14:25 GMT
Explorer.WindowState = olMaximized. You also haved enum members in the
OlWindowState enum for olMinimized and olNormalWindow.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> Many Many thanks, you've solved something i've been trying to do for ages.
> Once gain thanks.
[quoted text clipped - 5 lines]
>
> All the best for the new year
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.