Solved

outlook 2007 calendar

Posted on 2014-04-08
9
316 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
  • 3
  • 3
  • 3
9 Comments
 
LVL 91

Expert Comment

by:John Hurst
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
 

Author Comment

by:Basem Khawaja
ID: 39988785
Mr. Hurst
what other style would allow me to accomplish my goal?
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 91

Accepted Solution

by:
John Hurst 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 91

Expert Comment

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

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now