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.
Code:
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
olns.GetDefaultFolder(olFolderCalendar).Display
Else
Set ol.ActiveExplorer.CurrentFolder = olns.GetDefaultFolder(olFolderCalendar)
ol.ActiveExplorer.Display
End If
Set olExp = ol.ActiveExplorer.CurrentFolder.GetExplorer
Set viw = olExp.CurrentView
viw.GoToDate dtmDate
dtResult = viw.DisplayedDates
Exit_Here:
Cleanup:
On Error Resume Next
Set ol = Nothing
Set olns = Nothing
Set olExp = Nothing
Set viw = Nothing
GetOutLookCalendar = dtResult
Exit Function
GetOutLookCalendar = Date
Exit Function
ErrorHandler:
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.