Getting current calendar view

  • Thread starter Thread starter Dennis Brown
  • Start date Start date
D

Dennis Brown

What is the syntax for determining the current view in the 2003 Calendar?
I'm wanting to determine if I'm in Day, Workweek, Week, or Month view.
 
Hi Dennis,

in the Calendar view you could check the CommandBarButtons´ state. E.g.:

if ActiveExplorer.CommandBars.FindControl(,1094).State=msoButtonDown
Then
' it´s day view
Endif

The other FaceId´s are:

workweek: 5556
week: 1095
month view: 1096
 
Hi Michael,
Thanks a bunch!
Can I do this even if the user doesn't have that command bar selected for
display?
 
Hi Dennis,

what do you mean by "command bar selected"? Just check for the current
folder and then for the button´s state you´re looking for.
 
Hi there

I have a similar situation.

To dennis I say, yes, the code will work even if the toolbar is not selected.

To Michael I ask:

How can I set a view to say 'Month'? I tried:

ActiveExplorer.CommandBars.FindControl(, 1096).State = msoButtonDown

following your suggestion but it does not want to work.

Any Ideas?

Thanks
 
Hi Pierre,

it is almost done:

ActiveExplorer.CommandBars.FindControl(, 1096).Execute
 
Hi Michael

Thanks for your reply. I tried:

Set f=Application.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar)
With Application.ActiveExplorer
Set .CurrentFolder = f ' switches to
Calendar
.CurrentView = "Day/Week/Month" ' sets view
.CommandBars.FindControl(, 1096).Execute ' clicks the button
End With

This should, I had hoped, switch to 'Calendar', Set 'Day/week/Month' view
and execute the 'Month' button.

If I start off in 'Inbox' the code will switch to 'Calendar' view only
(after the macro is executed). The other two commands are seemingly not
executed

If I start off in any 'Calender' view (or step through the macro) everything
works.

Thanks
 
Back
Top