Bonjour à tous,
J'ai créé une macro sur Excel 2013 qui a pour but de s'exporter sur le calendrier outlook 2013.
Sur mon pc aucun problème cela fonctionne.
Cependant sur un autre ordinateur fonctionnant sous excel 2010 cela ne marche pas. De plus, sur cet ordi le fichier excel se nomme "name.pst" au lieu de "outlook.pst
Savez-vous d'où le problème peut venir ?
Je vous laisse en copie mon code:
Option Explicit
Sub Date_anniversaire()
'nécéssite d'activer la référence Microsoft Outlook 10.0 Object Library
Dim myOlApp As New Outlook.Application
Dim MyItem As Outlook.AppointmentItem
Dim Cell As Range
Dim dLgC As Long, dLgR As Long
For Each Cell In Range("A2:A" & Range("A22").End(xlUp).Row)
Set MyItem = myOlApp.CreateItem(olAppointmentItem)
With MyItem
.MeetingStatus = olNonMeeting
.Subject = Cell
.Start = Cell.Offset(0, 1)
.AllDayEvent = True
.Location = "Anniversaire"
.Save
End With
Set MyItem = Nothing
Next Cell
End Sub
Sub Date_arrivée()
'nécéssite d'activer la référence Microsoft Outlook 10.0 Object Library
Dim myOlApp As New Outlook.Application
Dim MyItem As Outlook.AppointmentItem
Dim Cell As Range
Dim dLgC As Long, dLgR As Long
For Each Cell In Range("A2:A" & Range("A22").End(xlUp).Row)
Set MyItem = myOlApp.CreateItem(olAppointmentItem)
With MyItem
.MeetingStatus = olNonMeeting
.Subject = Cell
.Start = Cell.Offset(0, 2)
.AllDayEvent = True
.Location = "arrivé"
.Save
End With
Set MyItem = Nothing
Next Cell
End Sub
Sub Date_finpériode1()
'nécéssite d'activer la référence Microsoft Outlook 10.0 Object Library
Dim myOlApp As New Outlook.Application
Dim MyItem As Outlook.AppointmentItem
Dim Cell As Range
Dim dLgC As Long, dLgR As Long
For Each Cell In Range("A2:A" & Range("A22").End(xlUp).Row)
Set MyItem = myOlApp.CreateItem(olAppointmentItem)
With MyItem
.MeetingStatus = olNonMeeting
.Subject = Cell
.Start = Cell.Offset(0, 3)
.AllDayEvent = True
.Location = "fin période 1"
.Save
End With
Set MyItem = Nothing
Next Cell
End Sub
Sub Date_finpériode2()
'nécéssite d'activer la référence Microsoft Outlook 10.0 Object Library
Dim myOlApp As New Outlook.Application
Dim MyItem As Outlook.AppointmentItem
Dim Cell As Range
Dim dLgC As Long, dLgR As Long
For Each Cell In Range("A2:A" & Range("A22").End(xlUp).Row)
Set MyItem = myOlApp.CreateItem(olAppointmentItem)
With MyItem
.MeetingStatus = olNonMeeting
.Subject = Cell
.Start = Cell.Offset(0, 4)
.AllDayEvent = True
.Location = "fin période 2"
.Save
End With
Set MyItem = Nothing
Next Cell
End Sub
Sub Echéance_mission()
'nécéssite d'activer la référence Microsoft Outlook 10.0 Object Library
Dim myOlApp As New Outlook.Application
Dim MyItem As Outlook.AppointmentItem
Dim Cell As Range
Dim dLgC As Long, dLgR As Long
For Each Cell In Range("A2:A" & Range("A22").End(xlUp).Row)
Set MyItem = myOlApp.CreateItem(olAppointmentItem)
With MyItem
.MeetingStatus = olNonMeeting
.Subject = Cell
.Start = Cell.Offset(0, 6)
.AllDayEvent = True
.Location = "échéance mission"
.Save
End With
Set MyItem = Nothing
Next Cell
With Sheets("Feuil1")
dLgC = .Range("A65536").End(xlUp).Row
If dLgC = 22 Then MsgBox "Il n'y a pas de données à transférer dans la feuille Resultats": End
Range("A2:F" & dLgC).Copy
End With
With Sheets("Feuil2")
dLgR = .Range("A65536").End(xlUp).Row + 1
.Range("A" & dLgR).PasteSpecial Paste:=xlPasteValues
End With
Sheets("Feuil1").Range("A2:F50").ClearContents
Sheets("Feuil2").Select
Call Date_anniversaire
Call Date_arrivée
Call Date_finpériode1
Call Date_finpériode2
End Sub
Merci d'avance
J'ai créé une macro sur Excel 2013 qui a pour but de s'exporter sur le calendrier outlook 2013.
Sur mon pc aucun problème cela fonctionne.
Cependant sur un autre ordinateur fonctionnant sous excel 2010 cela ne marche pas. De plus, sur cet ordi le fichier excel se nomme "name.pst" au lieu de "outlook.pst
Savez-vous d'où le problème peut venir ?
Je vous laisse en copie mon code:
Option Explicit
Sub Date_anniversaire()
'nécéssite d'activer la référence Microsoft Outlook 10.0 Object Library
Dim myOlApp As New Outlook.Application
Dim MyItem As Outlook.AppointmentItem
Dim Cell As Range
Dim dLgC As Long, dLgR As Long
For Each Cell In Range("A2:A" & Range("A22").End(xlUp).Row)
Set MyItem = myOlApp.CreateItem(olAppointmentItem)
With MyItem
.MeetingStatus = olNonMeeting
.Subject = Cell
.Start = Cell.Offset(0, 1)
.AllDayEvent = True
.Location = "Anniversaire"
.Save
End With
Set MyItem = Nothing
Next Cell
End Sub
Sub Date_arrivée()
'nécéssite d'activer la référence Microsoft Outlook 10.0 Object Library
Dim myOlApp As New Outlook.Application
Dim MyItem As Outlook.AppointmentItem
Dim Cell As Range
Dim dLgC As Long, dLgR As Long
For Each Cell In Range("A2:A" & Range("A22").End(xlUp).Row)
Set MyItem = myOlApp.CreateItem(olAppointmentItem)
With MyItem
.MeetingStatus = olNonMeeting
.Subject = Cell
.Start = Cell.Offset(0, 2)
.AllDayEvent = True
.Location = "arrivé"
.Save
End With
Set MyItem = Nothing
Next Cell
End Sub
Sub Date_finpériode1()
'nécéssite d'activer la référence Microsoft Outlook 10.0 Object Library
Dim myOlApp As New Outlook.Application
Dim MyItem As Outlook.AppointmentItem
Dim Cell As Range
Dim dLgC As Long, dLgR As Long
For Each Cell In Range("A2:A" & Range("A22").End(xlUp).Row)
Set MyItem = myOlApp.CreateItem(olAppointmentItem)
With MyItem
.MeetingStatus = olNonMeeting
.Subject = Cell
.Start = Cell.Offset(0, 3)
.AllDayEvent = True
.Location = "fin période 1"
.Save
End With
Set MyItem = Nothing
Next Cell
End Sub
Sub Date_finpériode2()
'nécéssite d'activer la référence Microsoft Outlook 10.0 Object Library
Dim myOlApp As New Outlook.Application
Dim MyItem As Outlook.AppointmentItem
Dim Cell As Range
Dim dLgC As Long, dLgR As Long
For Each Cell In Range("A2:A" & Range("A22").End(xlUp).Row)
Set MyItem = myOlApp.CreateItem(olAppointmentItem)
With MyItem
.MeetingStatus = olNonMeeting
.Subject = Cell
.Start = Cell.Offset(0, 4)
.AllDayEvent = True
.Location = "fin période 2"
.Save
End With
Set MyItem = Nothing
Next Cell
End Sub
Sub Echéance_mission()
'nécéssite d'activer la référence Microsoft Outlook 10.0 Object Library
Dim myOlApp As New Outlook.Application
Dim MyItem As Outlook.AppointmentItem
Dim Cell As Range
Dim dLgC As Long, dLgR As Long
For Each Cell In Range("A2:A" & Range("A22").End(xlUp).Row)
Set MyItem = myOlApp.CreateItem(olAppointmentItem)
With MyItem
.MeetingStatus = olNonMeeting
.Subject = Cell
.Start = Cell.Offset(0, 6)
.AllDayEvent = True
.Location = "échéance mission"
.Save
End With
Set MyItem = Nothing
Next Cell
With Sheets("Feuil1")
dLgC = .Range("A65536").End(xlUp).Row
If dLgC = 22 Then MsgBox "Il n'y a pas de données à transférer dans la feuille Resultats": End
Range("A2:F" & dLgC).Copy
End With
With Sheets("Feuil2")
dLgR = .Range("A65536").End(xlUp).Row + 1
.Range("A" & dLgR).PasteSpecial Paste:=xlPasteValues
End With
Sheets("Feuil1").Range("A2:F50").ClearContents
Sheets("Feuil2").Select
Call Date_anniversaire
Call Date_arrivée
Call Date_finpériode1
Call Date_finpériode2
End Sub
Merci d'avance