Solved

outlook 2007 calendar

Posted on 2014-04-08
9
323 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 94

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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

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

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 94

Expert Comment

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

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

735 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