|
Topic Topic Hot Topic New Topic Locked Topic Sticky Topic Hidden |
[RISOLTO]Invio mail |
Post Reply
|
Page <12 |
| Author | |
stefano267
Utente Base
Joined: 21/Set/2010 Status: Offline Points: 125 |
Post Options
Thanks(0)
Quote Reply
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
|
|
![]() |
|
65.franco
Utente Onorario
Joined: 19/Apr/2009 Location: Italy Status: Offline Points: 2926 |
Post Options
Thanks(0)
Quote Reply
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 ...
|
|
|
Franco...
|
|
![]() |
|
stefano267
Utente Base
Joined: 21/Set/2010 Status: Offline Points: 125 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
65.franco
Utente Onorario
Joined: 19/Apr/2009 Location: Italy Status: Offline Points: 2926 |
Post Options
Thanks(0)
Quote Reply
Posted: 09/Ago/2012 at 21:43 |
|
Scusa scusa scusa , ho dimenticato il percorso da allegare con il file ....
Ecco ... così deve andare bene.
Ciaooo ... Edited by 65.franco - 09/Ago/2012 at 21:44 |
|
|
Franco...
|
|
![]() |
|
stefano267
Utente Base
Joined: 21/Set/2010 Status: Offline Points: 125 |
Post Options
Thanks(0)
Quote Reply
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.........................
|
|
![]() |
|
stefano267
Utente Base
Joined: 21/Set/2010 Status: Offline Points: 125 |
Post Options
Thanks(0)
Quote Reply
Posted: 09/Ago/2012 at 21:55 |
|
Trovato , errore.................Attachments.Add strParh & strFileName
|
|
![]() |
|
65.franco
Utente Onorario
Joined: 19/Apr/2009 Location: Italy Status: Offline Points: 2926 |
Post Options
Thanks(0)
Quote Reply
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...
|
|
![]() |
|
stefano267
Utente Base
Joined: 21/Set/2010 Status: Offline Points: 125 |
Post Options
Thanks(0)
Quote Reply
Posted: 09/Ago/2012 at 21:57 |
|
Funziona perfettamente , grazie per l'aiuto ..........
|
|
![]() |
|
65.franco
Utente Onorario
Joined: 19/Apr/2009 Location: Italy Status: Offline Points: 2926 |
Post Options
Thanks(0)
Quote Reply
Posted: 09/Ago/2012 at 22:00 |
|
Non avevo dubbi ...
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...
|
|
![]() |
|
65.franco
Utente Onorario
Joined: 19/Apr/2009 Location: Italy Status: Offline Points: 2926 |
Post Options
Thanks(0)
Quote Reply
Posted: 09/Ago/2012 at 22:06 |
|
A proposito , se vuoi approfondire l'invio delle mail, l'argomento è stato trattato molte volte nel forum.
Ti consiglio di visionare una piccola demo che avevo realizzato tempòo fa : http://www.ialweb.it/forum/forum_posts.asp?TID=9247495&KW=mail&PN=1&title=demo-access-outlook-application-send-email-da-vba
Trovi i vari metodi per trattare tutte le informazioni che comunemente si usano in outllok.
Ciaooo ...
|
|
|
Franco...
|
|
![]() |
|
Post Reply
|
Page <12 |
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |