Friday, 26 December 2008

Outlook based multi-month calendar v2

The following script is version 2 of a macro that I have published in an earlier article.

Yearly Calendar version 2

What it does:
It displays all your Outlook appointments (longer than 0 minutes) for a number of months (you choose which) on one page.

What is new?
1) It is now a vbs script and no longer a Macro. Scripts are easier to run than macros - just double click the file "Yearly Calendar v2.vbs" (after downloading, rename the "Yearly Calendar v2.txt" file into "Yearly Calendar v2.vbs" first).
2) There are 3 output formats now (instead of one):
- one month per row
- one month per column
- 7 columns (Monday through Friday)
3) The restitution of Outlook appointment label colors is improved. They now also work for the non default calendars.

For the other features please refer to my previous article.

54 comments:

norm said...

This is just what I’m after..... I am new to all this and can’t get it to work. Is there a step by step guide I can use......?

Pieter Van Gorp said...

Hi, thanks for the update. For some reason, the macro didn't work anymore after an office update...

I did notice a problem with your code: I want to run it against a calendar that relies on recurring events. Unfortunately, your script only creates one output field per calendar event whereas it should create a field per recurring event occurrence... Could you please fix this and post an update? I would be even more grateful than I am already.

Sincerely,
Pieter Van Gorp

Carlos Galvan said...

Cool Tool !!

Got the macro to work! Awesome!

Where should the Yearly Calendar v2.vbs file be placed to work?

many Thanks

Pieter Van Gorp said...

Hi Carlos,
> Where should the Yearly Calendar v2.vbs
> file be placed to work?

You can place it anywhere you like. You run it by double-clicking the file or calling it from the command-line or another shell script (as opposed to the macro solution, which is run from within Outlook).

Any comments from the script author with regards to my previous comment on recurring events?

Regards,
Pieter

niveauverleih said...

Pieter: I checked and realized that recurring events DID appear, however only at the end of the list, after all non recurring events of the same day. I added a sort command and now it should be fixed.

Pieter Van Gorp said...

Still doesn't work for me... Please contact me and I will send you the ICS file for testing. In fact, you can just grab the public google calendar without contacting me personally.

Thanks for the debugging,
Pieter

george said...

Awesome tool. Works great except for one error - "Could not create the MAPI session to retrieve appointment cloors. Will continue without colors."
All data comes up just great.
Just love the ability to select the number of months.
Now to see if I can modify the script to enlarge row and/or column widths..
Thanks for all the work you put in...george

Anonymous said...

Got a windows scripting host error on line 533: Type missmatch UBound

Looks like the array "arrBinary" is empty...

Anonymous said...

Also got a windows scripting host error on line 533: Type missmatch UBound

Galorin said...

Looks promising, although I am getting the same errors as the others, arrBinary is not behaving as expected.

However, my errors are are on line 534 : For i = 0 To UBound(arrBinary)

It's returning a type mismatch, which means either arrBinary is emty, not initialised, or contains junk data. Seems to be a problem created by Windows Update as opposed to your own code. I don't have time to do a solution, plus I'm no good at VBS.

Victor said...

Hey Nick,

I found your name while searching the WWW and saw the Outlook VBA code. What, if anything, can be done to find a shared calendar?

Victor

semtex007 said...

I am also receiving the error message:-
on line 534 : For i = 0 To UBound(arrBinary)

Any clues, please?

Lausta said...

Not sure if this is still up and going, but I tried the link to your 2nd version and it doesn't seem to want to load for me. Thoughts?

Anonymous said...

It really works great. Unfortunately it is only passive display, but i still wonder why this is not in outlook...

Anonymous said...

i COULND'T GET IT TO RUN WITHER -- GOT THE MESSAGE "Could not create mapi session to retrieve appointment colors. Will continue without colors", and then nothing happened. Is there a fix? Thanks.

Jörg said...

Ein Super Programm-Danke für die Arbeit
Leider erhalte ich folgende Fehlermeldung: Could not create Mapi session to retrieve appointment color
Was muß ich verändern?

Anonymous said...

For those who have the "type mismatch" error (Ubound...)

Just add the following statement in the VBA script:
arrBinary = Array(1, 0)
under
'msgbox MainKeyPath

The result should look like this:

'msgbox MainKeyPath
arrBinary = Array(1, 0)
For i = 0 To UBound(arrBinary)
KeyValue = KeyValue & Chr(arrBinary(i))
Next

It worked for me using Vista and Outlook SP3 2003.
Regards from Germany
Mounir M.

Anonymous said...

Thanks so much, you're AWESOME.

I needed this and couldn't have done it myself - so glad you've made it available to everyone.

Perth Home said...

I followed the instructions by downloading and renaming as vbs. when i double click it just opens up the code in a browser.

Manolo said...

I am getting a

Type mismatch or the value "2009/07/01 12:00 am" in the condition is not valid.

Error in line 290 char 21

Running with an english VISTA and outlook 2003 but regional settings for Spain. Any suggestions?

diamondheart said...

Great job.. many thanks.. mad props and all that..

The previous version worked great. V2 however, throws this Windows Script Host error:

Line: 613
Char: 2
Error: 0x80041002
Code: 80041002
Source: (null)

Line 613 reads:

Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}//" & sComputer & "/root/default:StdRegProv")

anyone have any suggestions or ideas? would love to get the new one to work..

dns said...

Hi NiveauVerleih,

How do i change this script so that it can display multiple calendar?

Kind regards,

dns

Anonymous said...

GetColor Function do not generate the right color in the webpage.

Do anyone know how to fix this?

Many thanks...

Anonymous said...

Hi All,

The HTML output file is in English. How do i change the output for my own language?

Pls....anyone?

arjen said...
This comment has been removed by the author.
arjen said...

great script !!!!

I use vista & office2007 and I installed CDO. although the script says

Myfolder.IncludeRecurrences = True

to make recurrent appointments visible with me only the first appointment appears

I know that with XP & office 2003 all recurrent appointments appear with exactly the same script?

Can anyone tell how to change the code so all appointments appear?

arjen said...

it is always nice when you can solve your own problems
and the disadvantage of VBA-problems for me is that they stay in my mind until they are solved!

i read the change that was made for the problem from pieter van gorp ( see the comments aboves). i think the line

MyFolder.Sort "[Start]" was added
by NiveauVerleih to fix pieters problem

I now removed that line again and
:-) now everything works perfect
on my pc !
all appointments are visible !!!

Zee said...

Can someone advise me on getting the yearly view calendar to function in Outlook 2000? I have downloaded the file and clicking on the link brings up the script in my browser. how do I get the yearly view calendar to show up?

btw: what is the "injection_graph_func" file all about?
Thanks...

niveauverleih said...

To download the script, left click on the link. Copy the contents of the window that opens into a text file. Save the text file as "Yearly Calendar.vbs"

Colin said...

Works great but throws up the error
"Could not create mapi session to retrieve appointment colors. Will continue without colors"
Any ideas ??

Anonymous said...

the recurrent issue continues !

as i mentioned before the macro worked fine with xp&office2003 and vista&office2007

this my my configuration changed into xp&office2007 and now recurrent appointments do not appear

when i remove the line
MyFolder.Sort "[Start]"
suddenly recurrent appointments
appear every day of the week

does anyone know how to fix this?

and has anyone tested the macro with windows 7 & office2007

grtz
arjen

Anonymous said...

Just to be shure i tested the macro om vista & office2007-computer

the recurrent-problem now also
shows itself on this computer

i tested it also on earlier versions of my macro to check if the latest codechanges were the reason for the recurrent-problem but also in earlier versions the problem shows it self

it looks as if the problem has to do with outlook 2007 and the way recurrent appointments appear?

grtz
arjen

Anonymous said...

I'm also getting the "Could not create the MAPI session to retrieve appointment colors. Will continue without colors" error - No matter what I do (shared Calendar / local Calendar) - Dates n times match perfectly though, but the colors would be great..any ideas?

Sweet Choco said...

thank ou man , a brilliant work

Anonymous said...

Hallo,
Wird das Skript noch supportet?

Sieht interessant aus, leider läuft es bei mir nicht.
Es kommt zu einem Laufzeitfehler

d:\temp\yearly calender v2.vbs
Zeile 534
Zeichen 4
Fehler Typen unverträglich: 'Ubound'

Im Debugger sehe ich das arrBinary komplett leer ist.

Ich benutze Win7 Prof. und Outlook 2003 (beides aktueller Patchstand)
Liegt es an Windows7?

Gruß Markus

IreneSWilder said...

Thank you so much!

IreneSWilder said...

Thank you so much; I appreciate it!

Anonymous said...

Good job, but: Have the color-problem as well!

Doris said...

Has anyone figured out a way to fix the issue of recurring appointments not printing? Thanks!

Anonymous said...

I'm trying to get this script working. I saved the file to my desktop and renamed the file to Yearly Calendar V2.vbs but when I double-click the file opens in Wordpad. I checked via the command line to make sure the extension is in fact correct. I'm running Windows 7. Any ideas?

Anonymous said...

Thank you for this usefull tool!
Works perfectly!
The 7 columns view is the one that fits my needs.
I can cofirm the issues with not repeately shown recurring events. But I do not complain, what I get is nice (and free)! (-:

Alex said...

Not long ago I was at my friend's house and he showed me a next tool - ost recovery software. It didn't surprise me and forgot it. But this morning I woke up and understand that my emails had been lost. Luckily for me I used the tool - ost recovery software. It solved my problem quite rapidly, possible I was born under a lucky star.

Alexis said...

To my mind exist some groups of softwares for resolving other king of compter problems. But one day all these principles I forgot, because my emails were deleted on undetermined cause. I tried to use the Google and successfully unearthed one utility for solving this problem. It setlled my troubles for seconds and I count it would aid in this issue also - exchange restore from ost file.

Alex said...

My mother uses MS Outlook. She received one emails some days ago after that all accounts were damaged. Fortunately I promptly could dig up a feasible decision for this problem. It was a tool, which I regard would help in such proposition - how go i import outlook ost file.

Anonymous said...

Oh, unfortunately, it does not work anymore to get the makro.

Anonymous said...

How can I modify the code to work with the default Internet Browser (I use Firefox) rather then always opening IE.

mk_cn said...

Compile error:
Expected: =
How to deal with that error? Thanks!

Gabriel said...

Hey there,
ths is a great tool and I like to work with it. There is one Problem for me: I did import Events from excel into Outlook and they will not show in the exported Calendar! They have the same settings than any other events but they just dont show up. Very strange! Any Idea?

Anonymous said...

Cool stuff!!!
Works great and easy and free for so long time!!!
Best regards to the author!

PS: maby there some way to fix "MAPI session" error?

T:B: said...

Hallo, vielen Dank...genau was ich gesucht habe!
Wäre noch schön wenn es ein Lösung für das Problem mit den Farben gäb': "Could not create the MAPI session to retrieve appointment colors. Will continue without colors"

Schöne Grüße

T.B.

Anonymous said...

Works (Outlook 2002 Win 7 Pro) - however same MAPI message.

Anonymous said...

Wonderful Tool!!
But can't get it to work on Windows 8 64bit !!
I get a Windows Script Host Message saying:

Line: 534
Char: 4
Error: Type mismatch: 'UBound'
Code: 800A000D
Source: Microsoft VBScript runtime error

I am new to all this and can’t get it to work.
Your help is much appreciated, Many thanks

Ashers said...

To get the colors working in Outlook 2010+ (which doesn't have CDO), there are three sets of changes:

STEP 1) replace the entire GetColor function (i.e. from Function GetColor... down to its "End function") with the following:

Function GetColor(objAppt, storeID, onNamespace)

Colors="FFFFFF E7A1A2 F7DD8F F9BA89 FCFA90 78D168 9FDCC9 C6D2B0 9DB7E8 B5A1E2 DAAEC2 DAD9DC 6B7994 BFBFBF 6F6F6F 4F4F4F C11A25 E2620D C79930 B9B300 368F2B 329B7A 778B45 2858A5 5C3FA3 93446B"
GetColor = ""
If objAppt.Class = 26 Then ' = appointment
Cat = objAppt.categories
If Cat<>"" Then
'just the first cat
If InStr(Cat, ",") Then Cat=Left(Cat,InStr(Cat, ",")-1)
ColorCode = onNamespace.categories.item(Cat).Color
GetColor = Mid(Colors,ColorCode*7+1,6)
End if
End If
End Function

(note that you'll need to replace "," with your own field separator (e.g. ";" if you use "," for decimal points)

STEP 2) replace the line:
strColor = GetColor(myitem, storeID, objCDO)


with
strColor = GetColor(myitem, storeID, onNameSpace)

STEP 3) Delete the following 12 lines starting with:
'You must add a Reference to Microsoft CDO version 1.21.
down to (and including) "End If" following Msgbox "...."

Anonymous said...

Just a quick thank you, I have the colours issue but it is far better than what I had, I wish I was smart enough to understand it, let alone write it, :)