Solved

outlook 2007 calendar

Posted on 2014-04-08
9
329 Views
Last Modified: 2014-04-09
how do I print a time frame in outlook calendar i.e. 5/4/2014-6/28/2014 with out having the extra week showing 04/27/-5/3/2014 as the starting week and 6/29/14-7/5/2014 at the end.
thanks
0
Comment
Question by:Basem Khawaja
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
9 Comments
 
LVL 96

Expert Comment

by:Experienced Member
ID: 39987765
If you print it as a monthly style, then I don't think you can do this:  Outlook 2007, 2010 and 2013. It just prints the month. It has always been thus for me and I cannot change that.
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 39988104
Am looking into it via a macro.

Standy by.....
0
 

Author Comment

by:Basem Khawaja
ID: 39988783
ok thanks every one
0
What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

 

Author Comment

by:Basem Khawaja
ID: 39988785
Mr. Hurst
what other style would allow me to accomplish my goal?
0
 
LVL 96

Accepted Solution

by:
Experienced Member earned 500 total points
ID: 39988937
I have looked through various calendars. The Day, Week, Month styles are fixed and you cannot alter. There is (in Outlook 2013) a Calendar Details style that allows you to print any date range, but is a linear list and nothing that I can use.

So I use the monthly style (one page) and live with the dates.
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 39989042
I have made some progress with a macro, and can obtain the data you are after, but cannot assign it back to the default views in outlook it seems. (only obtain a frsh set of items ready to be displayed). You COULD tweak the code to pprint out the items as a listing, but I think you are really after a "calendar" form, are you not?

There is a "work-around" (which involves quite a bit of work though), By incorporating a Microsoft View Control on a Userform within the macro you may be able to build your own view for display completely seperate from the stanfdard views supplied my Outlook (which are not flecible at all)..I am not sure whether you are "up" on all this techinical VBA stuff, so I do apologize if you are not.

If you are, though, have a look at the following link which gives detailed instructions on setting up a View Control within the macro.

http://pabweb.ru/32ch15g.shtml

The code I have written shows below. It finds the required items but I cannot refresh them back to the Outlook Calendar which is showing on your desktop.

A thought is that macro code code pass its info to the Microsoft View Control (as detailed in the article) and then produce the output, without you having to interact with the control itself.
It could be be incorporated into the working of the control (or you could in fact just interact with the control yourself to produce the view).

As it is, with the macro alone all you have to do is enter the start and end dates.
If we incorporate the ViewCtrl we could have the macro passing this info to the control and producing the output using the controls display functionality.

Alternatively you could simply interact directly with the control itself (messier).

It is quite a bit of work, and the initial code took me several hours. I am very tired now
(I am getting close to 65 years old now and sitting up after 2am is tiring) but if you want me to press on in developing the "ViewCtrl" or expand on the VBA code I have already written, I can do so but it may take several days.

Let me know what you think..

Cheers
Chris (craisin)

Option Explicit

Public Sub CalendarView()
  'This module attempts to produce an extract of dates (a date range)
  'from the current outlook Calendar which is open, with the dates
  'enered by the operator as a start date and an end date.
  'Its aim is to produce a display of these calendar items in a view
  '(although this final stepo is still pending).
  
  'define variables and objects
  Dim myNameSpace As Outlook.NameSpace
  Dim oCalendar As Outlook.Folder
  Dim oView As Outlook.View
  Dim oItems As Outlook.Items
  Dim strStart As String
  Dim strEnd As String
  Dim dStart As Date
  Dim dEnd As Date
  Dim strFilter As String
  Dim objItem As Object
  Dim oItemsInDateRange As Outlook.Items

  'initialise various objects
  Set myNameSpace = Application.GetNamespace("MAPI")
  Set oCalendar = Application.Session.GetDefaultFolder(olFolderCalendar)
  Set oView = oCalendar.CurrentView
  Set oItems = oCalendar.Items
  
  'make sure the operator has a calendar view open
  If oView.ViewType = olCalendarView Then
    'there is error checking on the dates.
    'Note: You may need to tweak the code to agree with your localdate format
    '       e.g. Uk/Australia = "dd/mm/yyyy" whereas USA is "mm/dd/yyyy"
    
    'pick up the values used last time macro was run
    strStart = Format(GetSetting(Application.Name, "Setup", "CalendarViewStart", Now()), "dd/mm/yyyy")
    strEnd = Format(GetSetting(Application.Name, "Setup", "CalendarViewEnd", Now() + 31), "dd/mm/yyyy")
InputStart:
    On Error GoTo InputStart
    strStart = InputBox("Start date? (mm/dd/yyyy)", "Setup Calendar View", strStart)
    If Not IsDate(strStart) Then GoTo InputEnd
    dStart = CDate(strStart)
InputEnd:
    On Error GoTo InputEnd
    strEnd = InputBox("End date? (mm/dd/yyyy)", "Setup Calendar View", strEnd)
    If Not IsDate(strEnd) Then GoTo InputEnd
    dEnd = CDate(strEnd)
    On Error GoTo 0
    If dEnd < dStart Then
      MsgBox "End date must follow start date"
      GoTo InputStart
    End If
    'save the current values for next run
    SaveSetting Application.Name, "Setup", "CalendarViewStart", dStart
    SaveSetting Application.Name, "Setup", "CalendarViewEnd", dEnd
    
    'Now the fun begins!
    'these items must be performed n this order and results in a collection of
    'calendar items that meet the date restrictions (sorted into dare order, oldest to latest)
    oItems.IncludeRecurrences = True  'we need to incororate recurring items otherwise something
                                      'sheculed for "Wednesday each week" would only show once!
    strFilter = "[Start] >= '" & _
          Format(dStart, "ddddd") & " 12:00 AM'" & _
          " AND [End] <= '" & _
          Format(dEnd, "ddddd") & " 11:59 PM'"
    'You must "find" the first item for the filter to "kick-in"
    Set objItem = oItems.Find(strFilter)
    'now we use "restrict" rather than "filter" since "restirct" is much faster!
    Set oItemsInDateRange = oItems.Restrict(strFilter)
    'Now we sort the items
    oItemsInDateRange.Sort "[Start]", False
    'we could list these items to the debug screen if we want (useless but proves we obtained the items)
    'instead we will just produce a little message saying how many items are in the collection just to
    'prove things work.
    MsgBox "Calendar Items found: " + CStr(oItemsInDateRange.Count)
  Else
    MsgBox "Please make sure a calendar view is currently displaying"
  End If
End Sub

Open in new window

0
 

Author Closing Comment

by:Basem Khawaja
ID: 39989247
great guy
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 39989307
OK - It looks like you have accepeted someone else'scomment and you don't want me to go on with it....Good luck anyway.  :-)

Cheers
0
 
LVL 96

Expert Comment

by:Experienced Member
ID: 39989432
@basemkhawaja64 - Thank you and I was happy to help you.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question