'Determining selected Outlook Calendar date with VBA

I am trying to populate the appointment start date of an Outlook Calendar appointment template with the date the user has selected on their calendar.

Can someone offer VBA code that allows me determine what (if any) date the user has selected on their calendar?



Solution 1:[1]

Try something like the following.

If you are not sure what is exposed by a particular Outlook object, try OutlookSpy (I am its author). In this case, click Explorer, select CurrentView, click Browse.

set vExplorer = Application.ActiveExplorer
set vView = vExplorer.CurrentView
if TypeName(vView) = "CalendarView" Then
  MsgBox vView.SelectedStartTime & " - " & vView.SelectedEndTime
End If

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1