VBA method to know Time Period selected from Calendar Day view

  • Thread starter Thread starter devlei
  • Start date Start date
D

devlei

Does anyone know the VBA method to know what Time Period (say 08:00 am
to 10:00am) the user has selected on the 1 Day view from Calendar?
 
Hi,

there is no direct way.

Maybe possible, at least an interesting job, would be using some Win32
APIs. First you´need the Calendar´s window handle. With this you could
get its position and size. In this rectangle you can search pixel by
pixel for the color of selected rows. That´s the easy part of the job.

In addition you´d need an algorithm for getting the time. You could
store snaphots of each time, I mean e.g. the picture of 06:00, 07:00,
etc. But maybe there are better methods for recognizing pictures.

If you have e.g. the top position for a selected row then you could
"walk" left to the times and compare the pixels found there with your
stored snaphots.

Alternatively, of course, you could think about a re-design of your
solution. For humans it´s very easy to give you the needed data :-)
 
It is strange that there is no direct way, considering the fact that
Outlook itself does this very thing every time you select "New..
Appointment". It uses the Date/Time selected on your Day View and
automatically fills in the Start and End fields on your new item.
 
In OL2k the Calendar´s control class is named "AfxWnd". Maybe you can
find via Google with keywords like "AfxWnd" and "SendMessage" or
"PostMessage" tipps for getting more info from the control.

Another way I´d suggested in the thread "Re: Current date range showing
in a calendar view" in this group (please search with Google, too).
 
Back
Top