betsamee Asterisk Zeperyl | tu dois programmer le vba de ton outlook
tu dois aller dans la section ThisOutlookSession
et y mettre ton code vba
Petit exemple utile:
Code :
- Private Sub olInboxItems_ItemAdd(ByVal Item As Object)
-
- Dim Ind As Integer
- Dim WSHShell
- Dim ligne As String
- Dim chemin As String
- Dim PJ As Attachment
- Dim rejet
- Dim Ok
- Set rejet = CreateItem(olMailItem)
- Set Ok = CreateItem(olMailItem)
-
- Set WSHShell = CreateObject("wscript.shell" )
- ' si un nouveau message arrive
- chemin = "d:\XXXXX\"
- On Error Resume Next
-
-
- If Item.Class = olMail Then
-
- 'copie le fichie
- 'et lance le traitement If InStr(1, Item.Subject, "toto" ) <> 0 Then
-
- If Item.Attachments.Count > 0 Then
- Set PJ = Item.Attachments.Item(1)
- If InStr(1, PJ.DisplayName, "tutu" ) <> 0 Then
- chemin = chemin & PJ.DisplayName
- PJ.SaveAsFile (chemin)
- chemin = "msaccess "
- chemin = chemin & """"
- chemin = chemin & "d:\XXXX\XXX.mdb "
- chemin = chemin & """"
- chemin = chemin & " /x taMacro /cmd " & PJ.DisplayName
- shell(chemin)
- Set PJ = Nothing
- Else
- If Item.Attachments.Count = 2 Then
- Set PJ = Item.Attachments.Item(2)
- If InStr(1, PJ.DisplayName, "tutu" ) <> 0 Then
- chemin = chemin & PJ.DisplayName
- PJ.SaveAsFile (chemin)
- chemin = "msaccess "
- chemin = chemin & """"
- chemin = chemin & "d:\XXX\toto.mdb "
- chemin = chemin & """"
- chemin = chemin & " /x taMacro /cmd " & PJ.DisplayName
- ' RunProcess (chemin)
- End If
- End If
- End If
- End If
- End If
- End If
|
|