2009-02-13 8 views
4

J'ai une feuille de calcul (Excel 2003) qui suit les dates d'expiration, je voudrais savoir s'il existe un moyen d'avoir ces dates d'expiration créer des rendez-vous (rappels) dans Outlook. La date d'expiration est dans un champ et le nom de l'entité dans une autre colonne de la feuille de calcul. Idéalement, j'aimerais que Outlook (2003) prenne la date (évidemment) et le nom de l'entité.Créer automatiquement rendez-vous Outlook

Merci à l'avance pour toute aide

+0

Merci pour les suggestions, j'ai été tiré de ce projet pour le moment, donc je ne l'ai pas eu l'occasion de vérifier ce qui fonctionne par rapport à ce que ne marche pas! Dès que je peux, je le ferai. –

Répondre

0

Vous pouvez le faire via les invitations aux réunions. Ils ne seraient pas automatiquement acceptés, mais ils seraient là. Les invitations à des réunions ne sont que des e-mails avec des éléments spéciaux dans les en-têtes.

3

Voici un exemple de code.

Sub CreateCalEntry(LeadDate As Date, DueDate As Date, _ 
      Subject As String, Location As String, _ 
      Body As String, _ 
      Optional AddToShared As Boolean = True) 

'Lead date = expect notify from data' 
'Due date - expect event due date' 
'Add to shared - add item to shared calendar, ' 
'hard coded as 'Shared Calendar'' 

Const olApItem = 1 

Dim apOL As Object 'Outlook.Application ' 
Dim oItem As Object 'Outlook.AppointmentItem ' 
Dim objFolder As Object 'MAPI Folder ' 

    Set apOL = CreateObject("Outlook.Application") 
    Set objFolder = GetFolder(_ 
     "Public Folders/All Public Folders/Shared Calender") 
    Set oItem = apOL.CreateItem(olApItem) 

    With oItem 
     .Subject = Subject 
     .Location = Location 
     .Body = Body 

     If IsDate(LeadDate) Then 
      .Start = DueDate 
     Else 
      .Start = DueDate 
     End If 

     If AddToShared = True Then 
      .Move objFolder 
     End If 

     .Display 
    End With 

    Set oItem = Nothing 
    Set apOL = Nothing 

End Sub 

Public Function GetFolder(strFolderPath As String) As Object 
' strFolderPath needs to be something like ' 
' "Public Folders\All Public Folders\Company\Sales" or ' 
' "Personal Folders\Inbox\My Folder" ' 
'This code is from: 
'http://www.outlookcode.com/d/code/getfolder.htm ' 

Dim apOL As Object 'Outlook.Application ' 
Dim objNS As Object 'Outlook.NameSpace ' 
Dim colFolders As Object 'Outlook.Folders ' 
Dim objFolder As Object 'Outlook.MAPIFolder ' 
Dim arrFolders() As String 
Dim I As Long 

    strFolderPath = Replace(strFolderPath, "/", "\") 
    arrFolders() = Split(strFolderPath, "\") 

    Set apOL = CreateObject("Outlook.Application") 
    Set objNS = apOL.GetNamespace("MAPI") 

    On Error Resume Next 

    Set objFolder = objNS.Folders.Item(arrFolders(0)) 

    If Not objFolder Is Nothing Then 
     For I = 1 To UBound(arrFolders) 
      Set colFolders = objFolder.Folders 
      Set objFolder = Nothing 
      Set objFolder = colFolders.Item(arrFolders(I)) 

      If objFolder Is Nothing Then 
       Exit For 
      End If 
     Next 
    End If 

    Set GetFolder = objFolder 
    Set colFolders = Nothing 
    Set objNS = Nothing 
    Set apOL = Nothing 

End Function 

De: http://wiki.lessthandot.com/index.php/Create_Outlook_Appointment%2C_Shared_Folder