Wrox Programmer Forums
BOOK: Access 2010 VBA Programmer's Reference
This is the forum to discuss the Wrox book Access 2010 Programmer's Reference by Teresa Hennig, Rob Cooper, Geoffrey L. Griffith, Jerry Dennison; ISBN: 978-0-470-59166-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2010 VBA Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 21st, 2013, 01:14 PM
Registered User
Join Date: Jul 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to display OutLook Calendar in MS Access 2010

I have some code from your Chap 18 section however I want to display in minimized form the OutLook Calendar for a date displayed in a text box. Using your code I can get the calendar to open and display the date selected but I can't get it to display "on top" of the current form in a minimized window i.e. I want to show the calendar next to the field on the form without covering the entire form.

Public Function GetOutLookCalendar(dtmDate As Date) As Date
On Error GoTo ErrorHandler
Const CALLER As String = " OutLook Mail:GetOutLookCalendar "

Dim dtResult As Date
Dim ol As New Outlook.Application
   Dim olns As Namespace
   Dim viw As Outlook.CalendarView
   Dim olCal As Outlook.MAPIFolder
   Dim olExp As Outlook.Explorer

     'get the OutLook Object and then calendar
   Set ol = GetObject(, "Outlook.Application")
   Set olns = ol.GetNamespace("MAPI")
   If ol.ActiveExplorer Is Nothing Then
       Set ol.ActiveExplorer.CurrentFolder = olns.GetDefaultFolder(olFolderCalendar)
   End If
   Set olExp = ol.ActiveExplorer.CurrentFolder.GetExplorer
   Set viw = olExp.CurrentView
   viw.GoToDate dtmDate
   dtResult = viw.DisplayedDates

       On Error Resume Next
   Set ol = Nothing
   Set olns = Nothing
   Set olExp = Nothing
   Set viw = Nothing
   GetOutLookCalendar = dtResult
   Exit Function

   GetOutLookCalendar = Date
   Exit Function

    Select Case Err.Number
        Case 429
            Set ol = CreateObject("Outlook.application")
           Resume Next
        Case Else
            MsgBox Err.Description & vbCrLf & _
             Err.Number & vbCrLf & _
            "Called By :" & CALLER & vbCrLf & _
            Err.Source, VbMsgBoxStyle.vbCritical, "Could not add new name to data base" & vbCrLf & _
                "Module Name: = " & MODULENAME
                dtResult = 1 / 1 / 1890
            GoTo Cleanup
    End Select

End Function
The next step would be to extract the calendar info i.e. subject, location and start and end time for ALL appointments on the date selected.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Access 2010 and Access Services with SP 2010 kmaford BOOK: Professional SharePoint 2010 Development 0 September 14th, 2010 04:25 PM
Send MS Outlook Calendar Entry From ASP.NET wackoyacky ASP.NET 2.0 Basics 0 June 17th, 2007 10:02 AM
Emailing from MS Access using vba and outlook katd007 Access VBA 0 July 8th, 2004 12:48 PM
Display Chinese from MS Access Database johnman Classic ASP Basics 1 May 25th, 2004 11:37 PM
Using Outlook Calendar in Access Ray Pinnegar Access VBA 2 October 27th, 2003 04:44 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.