IALweb Homepage
Forum Home Forum Home > MS Office > Microsoft Office > Microsoft Access
  New Posts New Posts RSS Feed - [RISOLTO]Invio mail
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

 Topic   Topic Hot   Topic New   Topic Locked   Topic Sticky   Topic Hidden

[RISOLTO]Invio mail

 Post Reply Post Reply Page  <12
Author
Message
stefano267 View Drop Down
Utente Base
Utente Base


Joined: 21/Set/2010
Status: Offline
Points: 125
Post Options Post Options   Thanks (0) Thanks(0)   Quote stefano267 Quote  Post ReplyReply Direct Link To This Post Posted: 09/Ago/2012 at 21:21
Provato come esempio , sostituendo solo il percorso in rosso con "C:\Prova" di cui prova è la directory dove si trovano i file , però mi da l'errore di run-time '-2147467259 (8004005) impossibile identificare uno o più nomi ... e il debug si ferma su   .send
Back to Top
65.franco View Drop Down
Utente Onorario
Utente Onorario
Avatar

Joined: 19/Apr/2009
Location: Italy
Status: Offline
Points: 2926
Post Options Post Options   Thanks (0) Thanks(0)   Quote 65.franco Quote  Post ReplyReply Direct Link To This Post Posted: 09/Ago/2012 at 21:26
Rileggi e guarda meglio il post precedente ... ho tolto anche un controllo superfluo sulle cartelle, ci pensa getattr a restituire il tipo di oggetto letto nel ciclo.
 
Però devi mettere lo slash finale... altrimenti non ti legge nessun file
"C:\Prova\"
 
Riprova e fai sapere...
Ciaooo ... Wink
Franco...
Back to Top
stefano267 View Drop Down
Utente Base
Utente Base


Joined: 21/Set/2010
Status: Offline
Points: 125
Post Options Post Options   Thanks (0) Thanks(0)   Quote stefano267 Quote  Post ReplyReply Direct Link To This Post Posted: 09/Ago/2012 at 21:42
riprovato ma mi dice impossibile trovare ilfile. verificare che il percorso o il nome del file siano corretti e il debug si ferma su .Attachments.Add strFileName
Nella cartella Prova ci sono due file pdf chiamati x e y i quali uso per prove
 
il mio code  è :
 
Private Sub Comando304_Click()
Dim NewMail As MailItem
Dim strFileName As String
Dim strPath As String
strPath = "C:\Prova\"
Set NewMail = CreateObject("Outlook.Application").CreateItem(olMailItem)
With NewMail
.To = "rrrr@rrrrrr"
.Subject = ""
.Body = ""
.CC = ""
    strFileName = Dir(strPath, vbArchive)
    Do While strFileName <> ""
    If GetAttr(strPath & strFileName) = vbArchive Then .Attachments.Add strFileName
    strFileName = Dir
    Loop
    .Send
    End With
  
End Sub
Back to Top
65.franco View Drop Down
Utente Onorario
Utente Onorario
Avatar

Joined: 19/Apr/2009
Location: Italy
Status: Offline
Points: 2926
Post Options Post Options   Thanks (0) Thanks(0)   Quote 65.franco Quote  Post ReplyReply Direct Link To This Post Posted: 09/Ago/2012 at 21:43
Scusa scusa scusa , ho dimenticato il percorso da allegare con il file ....
 
Dim NewMail As MailItem
Dim strFileName As String
Dim strPath As String
strPath = "C:\Prova\"
Set NewMail = CreateObject("Outlook.Application").CreateItem(olMailItem)
With NewMail
.To = "rrrr@rrrrrr"
.Subject = ""
.Body = ""
.CC = ""
    strFileName = Dir(strPath, vbArchive)
    Do While strFileName <> ""
        If GetAttr(strPath & strFileName) = vbArchive Then .Attachments.Add strParh & strFileName
        strFileName = Dir
    Loop
.Send
End With
 
Ecco ... così deve andare bene.
Ciaooo ... Wink


Edited by 65.franco - 09/Ago/2012 at 21:44
Franco...
Back to Top
stefano267 View Drop Down
Utente Base
Utente Base


Joined: 21/Set/2010
Status: Offline
Points: 125
Post Options Post Options   Thanks (0) Thanks(0)   Quote stefano267 Quote  Post ReplyReply Direct Link To This Post Posted: 09/Ago/2012 at 21:54
Scusami Franco ,  ma ti stò tirando matto , non c'è verso di farlo andare da errore come prima e si ferma su
.Attachments.Add strParh & strFileName.........................
Back to Top
stefano267 View Drop Down
Utente Base
Utente Base


Joined: 21/Set/2010
Status: Offline
Points: 125
Post Options Post Options   Thanks (0) Thanks(0)   Quote stefano267 Quote  Post ReplyReply Direct Link To This Post Posted: 09/Ago/2012 at 21:55
Trovato , errore.................Attachments.Add strParh & strFileName
Back to Top
65.franco View Drop Down
Utente Onorario
Utente Onorario
Avatar

Joined: 19/Apr/2009
Location: Italy
Status: Offline
Points: 2926
Post Options Post Options   Thanks (0) Thanks(0)   Quote 65.franco Quote  Post ReplyReply Direct Link To This Post Posted: 09/Ago/2012 at 21:55
Per sicurezza e completezza ho provato le due righe di codice nel mio p.c.
 
Tutto funziona a dovere ...
 
Che errore ti da ?
Franco...
Back to Top
stefano267 View Drop Down
Utente Base
Utente Base


Joined: 21/Set/2010
Status: Offline
Points: 125
Post Options Post Options   Thanks (0) Thanks(0)   Quote stefano267 Quote  Post ReplyReply Direct Link To This Post Posted: 09/Ago/2012 at 21:57
Funziona perfettamente , grazie per l'aiuto ..........
Back to Top
65.franco View Drop Down
Utente Onorario
Utente Onorario
Avatar

Joined: 19/Apr/2009
Location: Italy
Status: Offline
Points: 2926
Post Options Post Options   Thanks (0) Thanks(0)   Quote 65.franco Quote  Post ReplyReply Direct Link To This Post Posted: 09/Ago/2012 at 22:00
Non avevo dubbi ... LOL
 
 
Ma se usi bene il debug vedrai che gli eerori li trovi e li correggi agevolmente.
 
Magari puoi anche , in fase di test, impostare prima del .Send , il comando .Display che ti consente di visionare come l'email viene preparata prima dell'invio. 


Edited by 65.franco - 09/Ago/2012 at 22:09
Franco...
Back to Top
65.franco View Drop Down
Utente Onorario
Utente Onorario
Avatar

Joined: 19/Apr/2009
Location: Italy
Status: Offline
Points: 2926
Post Options Post Options   Thanks (0) Thanks(0)   Quote 65.franco Quote  Post ReplyReply Direct Link To This Post Posted: 09/Ago/2012 at 22:06
A proposito , se vuoi approfondire l'invio delle mail, l'argomento è stato trattato molte volte nel forum.
 
 
Trovi i vari metodi per trattare tutte le informazioni che comunemente si usano in outllok.
 
Ciaooo ... Wink
Franco...
Back to Top
 Post Reply Post Reply Page  <12
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 10.11
Copyright ©2001-2012 Web Wiz Ltd.

This page was generated in 0,172 seconds.