[VBS] Récuperer des données par mail sous Excel

Récuperer des données par mail sous Excel [VBS] - VB/VBA/VBS - Programmation

Marsh Posté le 31-03-2004 à 17:26:58    

Voilà ,
J'expose mon problème. Je sais pas si c'est réalisable.
 
J'ai un formulaire sur le net, qui me renvoie un mail avec plsuieurs champs et valeurs.
 
J'ai ces mails sous Outlook Express 6
 
Et je veux creer une macro, pour recuperer ces infos sous excel.
 
Le champs 1 dans la colonne 1  
Le champs 2 dans la colonne 2  
....
 
Et creer un tableau avec mes données.
 
C'est faisable ? Vous avez des exemples ? des trucs a essayer.
 
Je m'y connait un peu en VBS, mais là je sèche :p
 
Merci d'avance !

Reply

Marsh Posté le 31-03-2004 à 17:26:58   

Reply

Marsh Posté le 02-04-2004 à 14:12:45    

Voici un début de piste pour Outlook (j'espère que ça marchera aussi bien avec outlook Express 6 )
Pense à ajouter , dans les références, la bibliothèque "microsoft outlook object library"
 
 
Dim OLapp As Outlook.Application
Dim OLspace As Outlook.NameSpace
Dim OLinbox As Outlook.MAPIFolder
Dim OLfolder As Outlook.MAPIFolder
Dim OLmail As Outlook.MailItem
Dim OLpj As Outlook.Attachment
 
 
Private Sub chMail()
 
Set OLapp = CreateObject("Outlook.application" )
Set OLspace = OLapp.GetNamespace("MAPI" )
Set OLinbox = OLspace.GetDefaultFolder(olFolderInbox)
 
For Each OLmail In OLinbox.Items
If OLmail.SenderName = "NomExpediteur, Prénom" Then
Dim OLbody As String
OLbody = OLmail.Body
 
Dim xlApp As Excel.Application
Dim wbk As Excel.Workbook
Dim sht As Excel.Worksheet
 
Set xlApp = CreateObject("Excel.Application" )
With xlApp
   .Visible = True
   Set wbk = .Workbooks.Add
   Set sht = wbk.ActiveSheet
   
      With sht
      .Range("A1" ) = OLbody
       End With
 
   wbk.SaveAs "C:\Chemin\Dossier\Fichier.xls"
   wbk.Close
   .Quit
   End With
   
Set sht = Nothing
Set wbk = Nothing
Set xlApp = Nothing
 
End If
Next
 
End Sub

Reply

Marsh Posté le 02-04-2004 à 14:19:16    

Ah yaisse !
Là je dis merci , j'y croyais plus :D
 
J'essaierai ça ce soir, mais merci d'avoir cherché [:jap]

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed