Changing calendar views

  • Thread starter Thread starter Douglas Quaid
  • Start date Start date
Status
Not open for further replies.
D

Douglas Quaid

Hi, I am new to Outlook and just getting my feet wet on the VB commands

for it, so I thought I would start with something simple but even this

little task is eluding me. I prefer to have my calendar view set to

"one day" for today, but all day long I need to set appointments one

month out, and I like to view the calendar one month out in Work Week

view. I would like to create one button I can click that will

automatically shift the view four weeks into the future and switch the

view to "Work Week," and another button that will take me back to today

and switch the view to "one day."

Also, I would like to make a button that shifts the view forward one

week, and another that shifts the view backwards one week. I would put

all these buttons on a custom toolbar so I could navigate around the

calendar easily.

Any help would be greatly appreciated.

Douglas Quaid
 
Outlook version?

"Douglas Quaid" <Douglas.Quaid.48a9c5f@outlookbanter.com> wrote in message

news:Douglas.Quaid.48a9c5f@outlookbanter.com...

> Hi, I am new to Outlook and just getting my feet wet on the VB commands
> for it, so I thought I would start with something simple but even this
> little task is eluding me. I prefer to have my calendar view set to
> "one day" for today, but all day long I need to set appointments one
> month out, and I like to view the calendar one month out in Work Week
> view. I would like to create one button I can click that will
> automatically shift the view four weeks into the future and switch the
> view to "Work Week," and another button that will take me back to today
> and switch the view to "one day."

> Also, I would like to make a button that shifts the view forward one
> week, and another that shifts the view backwards one week. I would put
> all these buttons on a custom toolbar so I could navigate around the
> calendar easily.

> Any help would be greatly appreciated.

> > Douglas Quaid
 
Outlook 2003 SP3

' - [MVP - Outlook Wrote:
> ;312287']Outlook version?

> >

>

> "Douglas Quaid" Douglas.Quaid.48a9c5f@outlookbanter.com wrote in
> message
> news:Douglas.Quaid.48a9c5f@outlookbanter.com...-

> Hi, I am new to Outlook and just getting my feet wet on the VB
> commands
> for it, so I thought I would start with something simple but even
> this
> little task is eluding me. I prefer to have my calendar view set to
> "one day" for today, but all day long I need to set appointments one
> month out, and I like to view the calendar one month out in Work Week
> view. I would like to create one button I can click that will
> automatically shift the view four weeks into the future and switch
> the
> view to "Work Week," and another button that will take me back to
> today
> and switch the view to "one day."

> Also, I would like to make a button that shifts the view forward one
> week, and another that shifts the view backwards one week. I would
> put
> all these buttons on a custom toolbar so I could navigate around the
> calendar easily.

> Any help would be greatly appreciated.

> > Douglas Quaid -


Douglas Quaid
 
To add any macro to a toolbar as a button select View, Toolbars, Customize.

Select the macro from the Commands list and drag it to the toolbar. A macro

is a Public Sub in an Outlook code module or in ThisOutlookSession.

I'll leave it to you to make the other macros for different time periods,

and also to add error handling and checking for things like each object not

being Nothing. Here's a macro that will move 4 weeks in the future. Note

that Work Week is from a button click, not directly from setting a specific

view.

Sub ViewChange()

Dim exp As Outlook.Explorer

Dim folder As Outlook.MAPIFolder

Dim button As Office.CommandBarButton

Dim dat As Date

Set exp = Application.ActiveExplorer

Set folder = exp.CurrentFolder

' set view

exp.CurrentView = "Day/Week/Month"

' set Work Week "view"

Set button = exp.CommandBars.Item("Standard").FindControl(id:=5556,

Recursive:=True)

button.Execute

' go to 4 weeks from now

dat = DateAdd("d", 28, Date)

exp.CurrentView.GoToDate dat

Set exp = Nothing

Set folder = Nothing

Set button = Nothing

End Sub

"Douglas Quaid" <Douglas.Quaid.48fe25e@outlookbanter.com> wrote in message

news:Douglas.Quaid.48fe25e@outlookbanter.com...

> Outlook 2003 SP3
> ' - [MVP - Outlook Wrote:
> > ;312287']Outlook version?
>

>> > >

> >

>

>
>
>
>
>
>> "Douglas Quaid" Douglas.Quaid.48a9c5f@outlookbanter.com wrote in
> > message
> > news:Douglas.Quaid.48a9c5f@outlookbanter.com...-
>

>> Hi, I am new to Outlook and just getting my feet wet on the VB
> > commands
> > for it, so I thought I would start with something simple but even
> > this
> > little task is eluding me. I prefer to have my calendar view set to
> > "one day" for today, but all day long I need to set appointments one
> > month out, and I like to view the calendar one month out in Work Week
> > view. I would like to create one button I can click that will
> > automatically shift the view four weeks into the future and switch
> > the
> > view to "Work Week," and another button that will take me back to
> > today
> > and switch the view to "one day."
>

>> Also, I would like to make a button that shifts the view forward one
> > week, and another that shifts the view backwards one week. I would
> > put
> > all these buttons on a custom toolbar so I could navigate around the
> > calendar easily.
>

>> Any help would be greatly appreciated.
>

>
>
>
>> > > Douglas Quaid -


> > Douglas Quaid
 
Thanks, Ken, this is good stuff. The one thing that worked a little

better for me was replacing "Date" with "Now" in the DateAdd code.

With "Date" it was going to 12 AM and then I would have to scroll down.

With "Now" it goes to the current time, which is perfect for me.

The only problem I still have is jumping forward or backward a week

from the currently selected date, as opposed to today's date. If you

could point me in the right direction for that I would really

appreciate it.

Douglas Quaid
 
The key is the DateAdd() function. Change 28 days to 7 and you jump a week.

Change it to -28 and you jump back 4 weeks from today. Make a new macro for

each different date jump you want and name them appropriately.

For more on DateAdd() use the help.

"Douglas Quaid" <Douglas.Quaid.49133df@outlookbanter.com> wrote in message

news:Douglas.Quaid.49133df@outlookbanter.com...

> Thanks, Ken, this is good stuff. The one thing that worked a little
> better for me was replacing "Date" with "Now" in the DateAdd code.
> With "Date" it was going to 12 AM and then I would have to scroll down.
> With "Now" it goes to the current time, which is perfect for me.

> The only problem I still have is jumping forward or backward a week
> from the currently selected date, as opposed to today's date. If you
> could point me in the right direction for that I would really
> appreciate it.

> > Douglas Quaid
 
Ken, I really appreciate your time. I don't think I explained what I am

trying to do well enough. I understand the DateAdd() function. What I

need to do, though, is to jump a week forward or back from the

Currently Selected Date. Not a week forward or back from Today. Does

that make sense?

The DateAdd() help only tells you how to jump from today, or from a

specific date. I need a command to return a string with whatever date

I'm currently looking at to fill in that last variable in the DateAdd

function.

' - [MVP - Outlook Wrote:
> ;312707']The key is the DateAdd() function. Change 28 days to 7 and you
> jump a week.
> Change it to -28 and you jump back 4 weeks from today. Make a new macro
> for
> each different date jump you want and name them appropriately.

> For more on DateAdd() use the help.

> >

>

>


Douglas Quaid
 
No way to do that in Outlook 2003. That's not exposed to the object model.

In Outlook 2007 you could use the new CalendarView.DisplayedDates property

to let you know which dates were currently visible in the UI.

"Douglas Quaid" <Douglas.Quaid.492855f@outlookbanter.com> wrote in message

news:Douglas.Quaid.492855f@outlookbanter.com...

> Ken, I really appreciate your time. I don't think I explained what I am
> trying to do well enough. I understand the DateAdd() function. What I
> need to do, though, is to jump a week forward or back from the
> Currently Selected Date. Not a week forward or back from Today. Does
> that make sense?

> The DateAdd() help only tells you how to jump from today, or from a
> specific date. I need a command to return a string with whatever date
> I'm currently looking at to fill in that last variable in the DateAdd
> function.
 
OK, thanks for your help Ken. One last thing- is there a list of all

the button IDs somewhere online (for example, Work Week View is 5556)?

' - [MVP - Outlook Wrote:
> ;312932']No way to do that in Outlook 2003. That's not exposed to the
> object model.

> In Outlook 2007 you could use the new CalendarView.DisplayedDates
> property
> to let you know which dates were currently visible in the UI.

> >

>

> "Douglas Quaid" Douglas.Quaid.492855f@outlookbanter.com wrote in
> message
> news:Douglas.Quaid.492855f@outlookbanter.com...-

> Ken, I really appreciate your time. I don't think I explained what I
> am
> trying to do well enough. I understand the DateAdd() function. What
> I
> need to do, though, is to jump a week forward or back from the
> Currently Selected Date. Not a week forward or back from Today.
> Does
> that make sense?

> The DateAdd() help only tells you how to jump from today, or from a
> specific date. I need a command to return a string with whatever
> date
> I'm currently looking at to fill in that last variable in the DateAdd
> function.-


Douglas Quaid
 
There are some at various places at www.outlookcode.com, but it's nothing

like a comprehensive list.

What I usually do is use OutlookSpy (www.dimastr.com) for that. I also use

it to get property tags for various MAPI properties. Anyway, that's how I

got the ID for that button for you. With OutlookSpy you select the Explorer

or Inspector button as appropriate and in the window that opens there's a

CommandBars tab. In that you select the relevant toolbar/menu and you'll see

a list of every button in that toolbar/menu.

For ribbon controls you set up to customize the QAT and each control's idMso

is then listed when you hover over the command. The idMso's are also listed

in the downloads for the ribbon schemas from Office Online.

"Douglas Quaid" <Douglas.Quaid.499713d@outlookbanter.com> wrote in message

news:Douglas.Quaid.499713d@outlookbanter.com...

> OK, thanks for your help Ken. One last thing- is there a list of all
> the button IDs somewhere online (for example, Work Week View is 5556)?
 
You can use the Outlook VBA code sample at

http://www.outlookcode.com/codedetail.aspx?id=1507 to get the all the IDs

for an Explorer. Or use the Outlook Spy tool from

http://www.dimastr.com/outspy/, as Ken suggested.

Sue Mosher
<kenslovak@mvps.org> wrote in message

news:%23ZlG$z8$JHA.3432@TK2MSFTNGP02.phx.gbl...
> There are some at various places at www.outlookcode.com, but it's nothing
> like a comprehensive list.

> What I usually do is use OutlookSpy (www.dimastr.com) for that. I also use
> it to get property tags for various MAPI properties. Anyway, that's how I
> got the ID for that button for you. With OutlookSpy you select the
> Explorer or Inspector button as appropriate and in the window that opens
> there's a CommandBars tab. In that you select the relevant toolbar/menu
> and you'll see a list of every button in that toolbar/menu.




> "Douglas Quaid" <Douglas.Quaid.499713d@outlookbanter.com> wrote in message
> news:Douglas.Quaid.499713d@outlookbanter.com...
>

>> OK, thanks for your help Ken. One last thing- is there a list of all
> > the button IDs somewhere online (for example, Work Week View is 5556)?

>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J Calendar events created on iPhone automatically changing default alert from 'None' to 'Time of Event' Using Outlook.com accounts in Outlook 0
J Outlook 2010 Changing events in Outlook calendar via opening file, importing CSV Using Outlook 0
R Outlook calendar appointments Free/Busy time is changing from "Busy" to "Free" Using Outlook 2
J Changing the ownership of calendar items Using Outlook 3
M Outlook 2012 Calendar Changing Secondary Calendar to Primary Calendar Using Outlook 1
H Changing Organizer of event (for single to total calendar move; long way ) Exchange Server Administration 4
R Shared Public calendar folder changing appointments Using Outlook 1
K Outlook 2010 'cannot send on behalf of' when changing calendar apointment Exchange Server Administration 0
B Changing Calendar format Using Outlook 1
F Auto changing email subject line in bulk Using Outlook 2
K Changing the Deleted Items location in Outlook 2019 Using Outlook 2
MattC Changing the font of an email with VBA Outlook VBA and Custom Forms 1
V Outlook 2021 Can anyone explain why my Outlook views keep changing?! Using Outlook 2
wayneame Changing the Form Used by Existing Task Items in a Folder Outlook VBA and Custom Forms 4
S Changing Message Class Outlook VBA and Custom Forms 4
C Pop Server Changing Verizon/Aol to Yahoo Using Outlook 6
P Outlook tasks keeps changing (updating) dates that I type Using Outlook 2
e_a_g_l_e_p_i Changing where data .pst is saved to Using Outlook 3
P Changing the font that the task view shows Using Outlook 5
S Changing colors of today's appointments, but not recurring ones Using Outlook 33
T Changing Sent Items location in Outlook 2019 Using Outlook 0
E Outlook view grouping keeps changing Using Outlook 3
B BCC issues after changing root folder path for gmail Using Outlook 1
M Changing the preferred order for "Put this entry in" list for adding new contacts to the Address Book Using Outlook 1
A .restrict results changing after moving to Exchange online Outlook VBA and Custom Forms 0
T Outlook Contacts ... Changing Font Size, Style, Bold, etc. Using Outlook 2
N Rule for "on behalf of" - with changing names Using Outlook 2
O Save attachments using hotkey without changing attributes Outlook VBA and Custom Forms 1
M Outlook 2016: Changing default font for Notes and Reading Pane Using Outlook 4
V Changing default date for task follow-up buttons Using Outlook 2
Gary Hile Outlook 2016 changing editor options Using Outlook 6
J Outlook Rules - Changing auto-submit address in multiple rules, according to rule name Outlook VBA and Custom Forms 0
S Problems syncing emails with webmail after changing to Outlook 2016 Using Outlook 1
T Changing default Mail Account in Outlook 2016 - POP3 Using Outlook 1
S Changing notification sound for new incoming messages in Outlook 365/2016 Using Outlook 1
Stephen Weinberg Changing the mailing address checkbox Using Outlook 0
D Outlook 2013 changing iCloud reminder time? Using Outlook 0
C Changing the name of Outlook Messages saved to a folder Using Outlook 1
A Outlook.com changing appointments Using Outlook 8
B Changing CC list to .add Outlook VBA and Custom Forms 2
Diane Poremsky Changing the Message Size in Exchange Server Using Outlook 0
R changing FW: on forward Outlook VBA and Custom Forms 3
B changing Win7 default backup schedule for Previous Versions Using Outlook 0
Diane Poremsky Changing the default *.pst and *.ost sizes Using Outlook 0
P Message Class keeps changing back to IPM.Contact Outlook VBA and Custom Forms 2
C Macro to send email after changing from address and adding signature Outlook VBA and Custom Forms 1
Diane Poremsky Changing Outlook.com color schemes Using Outlook 0
W Changing looks of emails in Outlook 2003 Using Outlook 0
L Office 365 Outlook changing default contact folder Using Outlook 0
Diane Poremsky Changing the From Domain in Office 365 Using Outlook 0

Similar threads

Back
Top