MACRO POUR EXPORTER LE CALENDRIER COMPLET OUTLOOK EN FORMAT VCALENDAR (VCS)

tekila_bandita Messages postés 248 Date d'inscription mercredi 15 juin 2005 Statut Membre Dernière intervention 15 mars 2007 - 24 févr. 2006 à 15:47
adlbg Messages postés 15 Date d'inscription mercredi 21 septembre 2005 Statut Membre Dernière intervention 14 mars 2015 - 21 févr. 2011 à 23:52
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/36208-macro-pour-exporter-le-calendrier-complet-outlook-en-format-vcalendar-vcs

adlbg Messages postés 15 Date d'inscription mercredi 21 septembre 2005 Statut Membre Dernière intervention 14 mars 2015
21 févr. 2011 à 23:52
Bonjour,
Ayant de multiples doublons
j'ai exporté Outlook en cal.vcs;
j'ai créé un fichier Nouveau.vcs expurgé,
j'ai "délété" tous les Evénements dans Outlook
j'ai Importé le .vcs
Tout est bien
SAUF QUE LES LETTRES NON COURANTES (accentuées, ç etc) ONT DISPARU dans Outlook

QUE FAIRE ?????
Remerciements
bien@vous
lagon100 Messages postés 1 Date d'inscription mercredi 19 novembre 2008 Statut Membre Dernière intervention 19 novembre 2008
19 nov. 2008 à 20:29
Pour ceux à qui ça interesse encore, pour que l'heure soit en GMT il faut remplacer les lignes ci-dessus (Outlook 2007) :

Print #6, "DTSTART:" & Format(objAppointment.Start, "yyyymmdd") & "T" & Format(objAppointment.Start, "hhmmss") & "Z"
Print #6, "DTEND:" & Format(objAppointment.Start, "yyyymmdd") & "T" & Format(objAppointment.Start, "hhmmss") & "Z"

par ---->

Print #6, "DTSTART:" & Format(objAppointment.StartUTC, "yyyymmdd") & "T" & Format(objAppointment.StartUTC, "hhmmss") & "Z"
Print #6, "DTEND:" & Format(objAppointment.EndUTC, "yyyymmdd") & "T" & Format(objAppointment.EndUTC, "hhmmss") & "Z"
olicam1 Messages postés 5 Date d'inscription jeudi 17 juillet 2008 Statut Membre Dernière intervention 31 octobre 2008
31 oct. 2008 à 18:06
salut à tous

quelqu'un saurait-il transposer ce code pour enregistrer l'agenda au format html dans un répertoire spécifique ? J'ai besoin d'une macro qu'on peut executer par une touche Ctrlxxx ou bien une macro qui s'execute sur une action particulière.

Merci
cs_sebastienserre Messages postés 1 Date d'inscription mercredi 16 juillet 2008 Statut Membre Dernière intervention 16 juillet 2008
16 juil. 2008 à 10:24
Bonjour,

Il y a t'il un lien explixcant comment importer cette macro dans Outlook 2007 ?

Cordialement
flyjodel Messages postés 3 Date d'inscription dimanche 29 octobre 2006 Statut Membre Dernière intervention 14 janvier 2008
14 janv. 2008 à 21:20
pour faire avancer un peu le schmilibilik, j'ai trouvé ici http://www.ietf.org/rfc/rfc2445.txt des infos sur les fuseaux horaires et comment les utiliser: chercher le texte suivant, page 137

BEGIN:VCALENDAR
PRODID:-//RDU Software//NONSGML HandCal//EN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:US-Eastern
BEGIN:STANDARD
DTSTART:19981025T020000
RDATE:19981025T020000
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:EST
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:19990404T020000
RDATE:19990404T020000
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:EDT
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:19980309T231000Z
UID:guid-1.host1.com
ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com
ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:
MAILTO:employee-A@host.com
DESCRIPTION:Project XYZ Review Meeting
CATEGORIES:MEETING
CLASS:PUBLIC
CREATED:19980309T130000Z
SUMMARY:XYZ Project Review
DTSTART;TZID=US-Eastern:19980312T083000
DTEND;TZID=US-Eastern:19980312T093000
LOCATION:1CP Conference Room 4350
END:VEVENT
END:VCALENDAR
flyjodel Messages postés 3 Date d'inscription dimanche 29 octobre 2006 Statut Membre Dernière intervention 14 janvier 2008
14 janv. 2008 à 20:59
le problème vient de ce que le fuseau horaire (ou le décalage heure d'hiver / heure d'été ) n'est pas pris en compte dans Outlook, il exporte les heures locales mais le format VCS ne connait que les heures TU. Donc en hiver il manque toujours une heure, et en été deux. Il faut remplacer le "-1" par "-2" dans mon nouveau code pour l'utiliser en été.

D'autre part, j'ai modifié le code pour pouvoir exporter seulement une plage de dates.
Je ne peux pas modifier le commentaire précédent qui est parti un peu vite, ne tenez pas compte des lignes " a = Format(DateAdd("h", -1, objAppointment.Start), "hhmmss")
MsgBox (a)" qui n'étaient là que pour tester.

Je cherche une fonction qui renvoie le fuseau horaire utilisé, ça existe dans VBA ?
flyjodel Messages postés 3 Date d'inscription dimanche 29 octobre 2006 Statut Membre Dernière intervention 14 janvier 2008
14 janv. 2008 à 20:55
Sub exportCSV()

Dim dirLocation As String

dirLocation = InputBox("Donnez un emplacement sur votre disque et un nom de fichier avec l'extsension .vcs (e.g., c:\cal.vcs). Vous pourrez importer ce fichier à partir de WEbcalendar")
ExportStart = InputBox("indiquez la date de début au format YYYYMMDD")
ExportEnd = InputBox("indiquez la date de fin au format YYYYMMDD")
If dirLocation Null Or Len(dirLocation) 0 Then
Exit Sub
End If

Dim objApplication As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objAppointments As Outlook.MAPIFolder
Dim objAppointment As Outlook.AppointmentItem
Dim appointmentIndex As Integer

Set objApplication = CreateObject("Outlook.Application")
Set objNameSpace = objApplication.GetNamespace("MAPI")
Set objAppointments = objNameSpace.GetDefaultFolder(olFolderCalendar)

Open dirLocation For Output As #6
Print #6, "BEGIN:VCALENDAR"
Print #6, "PRODID:-//Microsoft Corporation//Outlook 9.0 MIMEDIR//EN"
Print #6, "VERSION:1.0"
For appointmentIndex = 1 To objAppointments.Items.Count
Set objAppointment = objAppointments.Items.Item(appointmentIndex)
If (Format(objAppointment.Start, "yyyymmdd") >= ExportStart And Format(objAppointment.End, "yyyymmdd") <= ExportEnd) Then

Print #6, "BEGIN:VEVENT"

If objAppointment.AllDayEvent = True Then
Print #6, "TRANSP:1"
End If


a = Format(DateAdd("h", -1, objAppointment.Start), "hhmmss")
MsgBox (a)


Print #6, "DTSTART:" & Format(objAppointment.Start, "yyyymmdd") & "T" & Format(DateAdd("h", -1, objAppointment.Start), "hhmmss") & "Z"
Print #6, "DTEND:" & Format(objAppointment.End, "yyyymmdd") & "T" & Format(DateAdd("h", -1, objAppointment.End), "hhmmss") & "Z"
Print #6, "SUMMARY;ENCODING=QUOTED-PRINTABLE:" & objAppointment.Subject
Print #6, "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & objAppointment.Body
Print #6, "PRIORITY:" & objAppointment.Importance
Print #6, "END:VEVENT"
End If

Next
Print #6, "END:VCALENDAR"
Close #6
MsgBox "Le calendrier a été exporté dans : " & dirLocation

End Sub
FABMC2 Messages postés 8 Date d'inscription mercredi 4 août 2004 Statut Membre Dernière intervention 28 août 2009
8 juin 2007 à 22:31
Très bien, n'exporte pas les rdv périodiques.

J'ai trouvé une aide microsoft à ce sujet mais qui concerne outlook 97 (propriété IncludeRecurrences)

Je ne l'ai pas testé sous Outlook 97 mais sous 2003 et ça ne fonctionne pas!!! mille millions de sabords!

Voici le bout de code pour info...si quelqu'un a une solution ...

' Set the IncludeRecurrences property to make sure all of the
' recurring appointments are also included in the collection.
myItems.IncludeRecurrences = True

Exemple au complet :

Sub GetRecurrences()
' This example is VBA automation code and assumes you have the
' Outlook Object Library referenced.
Dim myOlApp As Outlook.Application
Set myOlApp = New Outlook.Application
' Set myItems to all of the items in the folder
Set myItems = myOlApp.ActiveExplorer.CurrentFolder.Items
' Sort the collection based on the start date/time of the appt.
myItems.Sort "[Start]"
' Set the IncludeRecurrences property to make sure all of the
' recurring appointments are also included in the collection.
myItems.IncludeRecurrences = True
' Display one of the recurring appointments which have been included.
MsgBox "The fifth instance of the recurring appointment " & _
"occurs on:" & myItems.Item(5).Start
End Sub
cs_yoshitsune56 Messages postés 1 Date d'inscription mercredi 25 avril 2007 Statut Membre Dernière intervention 25 avril 2007
25 avril 2007 à 11:34
Bonjour,
Ce code marche très bien mais je voulais savoir si quelqu'un avait une idée pour que l'affichage (couleurs, police,catégories créées...) soit aussi sauvegardé?
Merci d'avance...
cs_sophie_net Messages postés 1 Date d'inscription samedi 21 avril 2007 Statut Membre Dernière intervention 21 avril 2007
21 avril 2007 à 16:35
au fait, ptite erreur ligne 31:
c'est plutôt
Print #6, "DTEND:" & Format(objAppointment.End, "yyyymmdd") & "T" & Format(objAppointment.End, "hhmmss") & "Z"
il me semble,non?
thaca59 Messages postés 1 Date d'inscription dimanche 25 mars 2007 Statut Membre Dernière intervention 25 mars 2007
25 mars 2007 à 20:02
Je souhaiterais récuperer les données d'un calendrier outlook dans excel pour pouvoir completer un petit programme de notes de frais que j'ai écrit. Mes connaissances sont assez limitées mais je pense que le code ci-dessus ne doit pas être très éloigné de ce que je veux faire. Quelqu'un peut-il me donner la solution ?
Merci d'avance.
cs_PtiteFille Messages postés 1 Date d'inscription mardi 13 décembre 2005 Statut Membre Dernière intervention 22 août 2006
22 août 2006 à 17:56
Le code fonctionne très bien avec outlook 2003
Le seul problème que je rencontre est :

Le contenu des evenements ne s'importe pas forcement. Cela ne respecte pas la charte Vcs.
Il faut que devant les retour chariot il y ait =0d=0a.
Mais je n'arrive pas a le faire.
Ca se met toujours au mauvais endroit.

Quelqu'un peu m'aider ?

Merci
dlimouzin Messages postés 11 Date d'inscription mardi 31 décembre 2002 Statut Membre Dernière intervention 30 décembre 2008
20 août 2006 à 13:38
Celà ne marche pas pour moi : Outlook 2003
L'erreur est : Incompatibilité de type et se produit à la ligne 25
Set objAppointment = objAppointments.Items.item(appointmentIndex)

MS aurait-il changé des choses dans ses versions récentes ?
Amicalement et A+
coucou1953 Messages postés 2 Date d'inscription mardi 4 juillet 2006 Statut Membre Dernière intervention 4 juillet 2006
4 juil. 2006 à 13:03
Merci.

C'est la conclusion à laquelle je suis parvenu.
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
4 juil. 2006 à 11:04
heure locale <=> heure system, il faut convertir avant.
coucou1953 Messages postés 2 Date d'inscription mardi 4 juillet 2006 Statut Membre Dernière intervention 4 juillet 2006
4 juil. 2006 à 10:33
Aucun problème pour exporter le calendrier au format vcs mais lors de l'importation du fichier vcs dans Outlook toutes les heures sont augmentées de 2 !

Quelqu'un peut-il m'expliquer pourquoi ?

Merci.
cs_sayann Messages postés 11 Date d'inscription lundi 6 mars 2006 Statut Membre Dernière intervention 9 février 2009
7 mars 2006 à 14:31
Salut!
J'ai testé et ça marche du tonnerre en exécutant la macro à partir de microsoft visual basic. Mais essayant directement depuis outlook, il génère une erreur "Sub, Function ou Property non définie (erreur 35)".
Qu'est-ce que cela signifie ? Y a-t-il un moyen de corriger le problème ?
Merci d'avance
Sayann
shmurz Messages postés 6 Date d'inscription mardi 8 février 2005 Statut Membre Dernière intervention 24 août 2010
1 mars 2006 à 14:07
C'est exactement ce que j'étais en train de chercher. Je vais voir s'il n'est pas possible de choisir un intervalle pour l'export du calendrier, plutôt que de tout sélectionner.
J'ai vu que la sélection d'événement se faisait par index, je vais chercher sans doute de ce côté-là.

++
tekila_bandita Messages postés 248 Date d'inscription mercredi 15 juin 2005 Statut Membre Dernière intervention 15 mars 2007 33
24 févr. 2006 à 15:47
C'est du VB, pas du VBS...
Rejoignez-nous