OVH Cloud OVH Cloud

detacheur auto de PJ

2 réponses
Avatar
Chris
Bonsoir

Je cherche un script ou logiciel qui me permetterais de dettacher des
fichiers recu par mail en automatique sur un dossier du PC.

J'ai en effet une Boite exchange qui recoit en permanace des mail de clients
avec des fichiers afin de les integrer a notre SQLsrv, si je pouvais
automatiser ce travail manuel via un robot cela me ferais gagner bcp de
temps.

La cerise serait de plus belle si je pouvait dire quels extension de
fichiers doivent etre detachés. (.txt, .xml, .dat = OK
et .doc, .xls = Pas OK)

Merci a tous

Chris

2 réponses

Avatar
Oliv'
Bonsoir

Je cherche un script ou logiciel qui me permetterais de dettacher des
fichiers recu par mail en automatique sur un dossier du PC.

J'ai en effet une Boite exchange qui recoit en permanace des mail de
clients avec des fichiers afin de les integrer a notre SQLsrv, si je
pouvais automatiser ce travail manuel via un robot cela me ferais
gagner bcp de temps.

La cerise serait de plus belle si je pouvait dire quels extension de
fichiers doivent etre detachés. (.txt, .xml, .dat = OK
et .doc, .xls = Pas OK)

Merci a tous

Chris


A partir de OUTLOOK c'est possible.
Tu peux également utiliser l'évenement newmail (application_newmail) pour
tester tous les mails qui arrivent.

inspire toi de cela :

Sub FichiersJoints()
'Map toolbar button to this macro
' création OLIVIER CATTTEAU 2005

On Error Resume Next
Dim myOlApp As New Outlook.Application

If Application.ActiveInspector Is Nothing Then GetSelectedItems
If Application.ActiveInspector.CurrentItem.Attachments.Count = 0 Then
MsgBox "Pas de fichiers joints"
GoTo fin
End If


'parcours des fichiers attachés
################################################################################
Dim objAtt As Attachment, objAtts As Attachments, PAS_EDI As Boolean

Set objCurrentMessage = ActiveInspector.CurrentItem
Set objAtts = objCurrentMessage.Attachments

'#################################Traitement des fichiers joints
###################################################
For Each objAtt In objAtts
'c est la que tu mets le nouveau nom et /ou les conditions
repertoire = "c:temp"
Fichier = objAtt.FileName 'donne le meme nom que la pieces jointe
if ucase(right(objAtt.FileName,3))="XLS" then
objAtt.SaveAsFile repertoire & Fichier
end if
Next objAtt
''' Clean up everything.
On Error Resume Next

fin:
'ouvre le repertoire
cmdshell = "explorer " & repertoire
Shell cmdshell, vbMaximizedFocus

End Sub



--
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Have a nice day
Oliv'
Pour me joindre : http://cerbermail.com/?V8r2o1YHl4
les sites références:
Excel :http://www.excelabo.net http://xcell05.free.fr/
http://dj.joss.free.fr/
http://frederic.sigonneau.free.fr/ http://www.excel-vba-francais.com/
Word : http://faqword.free.fr/
Outlook :http://faq.outlook.free.fr/
Sql :http://sqlpro.developpez.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Avatar
Chris Toubib
"Oliv'" <(supprimerceci) a écrit dans le
message de news:

Bonsoir

Je cherche un script ou logiciel qui me permetterais de dettacher des
fichiers recu par mail en automatique sur un dossier du PC.

J'ai en effet une Boite exchange qui recoit en permanace des mail de
clients avec des fichiers afin de les integrer a notre SQLsrv, si je
pouvais automatiser ce travail manuel via un robot cela me ferais
gagner bcp de temps.

La cerise serait de plus belle si je pouvait dire quels extension de
fichiers doivent etre detachés. (.txt, .xml, .dat = OK
et .doc, .xls = Pas OK)

Merci a tous

Chris


A partir de OUTLOOK c'est possible.
Tu peux également utiliser l'évenement newmail (application_newmail) pour
tester tous les mails qui arrivent.

inspire toi de cela :

Sub FichiersJoints()
'Map toolbar button to this macro
' création OLIVIER CATTTEAU 2005

On Error Resume Next
Dim myOlApp As New Outlook.Application

If Application.ActiveInspector Is Nothing Then GetSelectedItems
If Application.ActiveInspector.CurrentItem.Attachments.Count = 0 Then
MsgBox "Pas de fichiers joints"
GoTo fin
End If


'parcours des fichiers attachés
################################################################################
Dim objAtt As Attachment, objAtts As Attachments, PAS_EDI As Boolean

Set objCurrentMessage = ActiveInspector.CurrentItem
Set objAtts = objCurrentMessage.Attachments

'#################################Traitement des fichiers joints
###################################################
For Each objAtt In objAtts
'c est la que tu mets le nouveau nom et /ou les conditions
repertoire = "c:temp"
Fichier = objAtt.FileName 'donne le meme nom que la pieces jointe
if ucase(right(objAtt.FileName,3))="XLS" then
objAtt.SaveAsFile repertoire & Fichier
end if
Next objAtt
''' Clean up everything.
On Error Resume Next

fin:
'ouvre le repertoire
cmdshell = "explorer " & repertoire
Shell cmdshell, vbMaximizedFocus

End Sub



--
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Have a nice day
Oliv'
Pour me joindre : http://cerbermail.com/?V8r2o1YHl4
les sites références:
Excel :http://www.excelabo.net http://xcell05.free.fr/
http://dj.joss.free.fr/
http://frederic.sigonneau.free.fr/ http://www.excel-vba-francais.com/
Word : http://faqword.free.fr/
Outlook :http://faq.outlook.free.fr/
Sql :http://sqlpro.developpez.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Merci je test et je reviens !



Chris