feed
top
crea forum
cerca
feed
forum
supporto
discussione
cerca
Stellar Blade
Un'esclusiva
PS5
che sta facendo discutere per l'eccessiva bellezza della protagonista. Vieni a parlarne su
Award & Oscar!
Excel Forum
Soluzioni Excel Domande e Risposte
VBA - invio file excel via email
Nuova Discussione
|
Rispondi
Login
|
Registrati
SI
NO
Pagina precedente
|
1
|
Pagina successiva
Vota
|
Stampa
|
Notifica email
« Discussione Precedente
|
Lista
|
Discussione Successiva »
Autore
VBA - invio file excel via email
Ultimo Aggiornamento:
10/10/2019
10:01
stellablu79
Post: 32
Registrato il: 29/06/2008
Città: ACQUAFONDATA
Età: 44
Utente Junior
excel 2007
OFF
LINE
02/10/2019
16:46
Email
Scheda Utente
Modifica
Cancella
Quota
0
0
#1
ciao a Tutti
ho un file con una macro che mi invia ogni sheet di un file excel ad un indirizzo email in cella A1
questa la macro:
Sub Mail_Every_Worksheet()
Dim sh As Worksheet
Dim wb As Workbook
Dim FileExtStr As String
Dim FileFormatNum As Long
Dim TempFilePath As String
Dim TempFileName As String
Dim OutApp As Object
Dim OutMail As Object
TempFilePath = Environ$("temp") & "\"
If Val(Application.Version) < 12 Then
'You use Excel 97-2003
FileExtStr = ".xls": FileFormatNum = -4143
Else
'You use Excel 2007-2016
FileExtStr = ".xlsm": FileFormatNum = 52
End If
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set OutApp = CreateObject("Outlook.Application")
For Each sh In ThisWorkbook.Worksheets
If sh.Range("A1").Value Like "?*@?*.?*" Then
sh.Copy
Set wb = ActiveWorkbook
TempFileName = "Sheet " & sh.Name & " of " _
& ThisWorkbook.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss")
Set OutMail = OutApp.CreateItem(0)
With wb
.SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
On Error Resume Next
With OutMail
.to = sh.Range("A1").Value
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add wb.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0
.Close savechanges:=False
End With
Set OutMail = Nothing
Kill TempFilePath & TempFileName & FileExtStr
End If
Next sh
Set OutApp = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
ora il mio problema è inviare tutto il file excel se presente qeusto indirizzo email in A1
vi spiego meglio: il mio file ha due foglio sheet1 e sheet2, quindi metto email in A1 di sheet2 e il foglio va' automaticamente via email; ma se io invece volessi mandare anche sheet1 sempre alla stessa email? mettendo l'email anche in A1 di sheet1 la macro funziona ma genera 2 EMAIL differenti (sempre allo stesso indirizzo in A1)
qualcuno riesce ad aiutarmi ?
grazie come sempre
Paola
stellablu79
Post: 32
Registrato il: 29/06/2008
Città: ACQUAFONDATA
Età: 44
Utente Junior
excel 2007
OFF
LINE
10/10/2019
10:01
Email
Scheda Utente
Modifica
Cancella
Quota
0
0
#2
nessuno ? :-(
grazie
Vota:
Amministra Discussione: |
Chiudi
|
Sposta
|
Cancella
|
Modifica
|
Notifica email
Pagina precedente
|
1
|
Pagina successiva
Nuova Discussione
|
Rispondi
Comunità
Forum
Registrati
Unisciti
Cerca
Lista Utenti
|-- Soluzioni Excel Domande e Risposte
|-- Solamente Presentazioni
|-- I vostri lavori
|-- 4 Chiacchere & OT
Cerca nel forum
Cerca
nei titoli
,
nei messaggi
,
con Google
cerca discussioni con titolo simile
Tag discussione
vba
copia
nuovo
dopo
file
excel
email
Discussioni Simili
[
vedi tutte
]
Feed
|
Forum
|
Bacheca
|
Album
|
Utenti
|
Cerca
|
Login
|
Registrati
|
Amministra
Tutti gli orari sono GMT+01:00. Adesso sono le 20:31. Versione:
Stampabile
|
Mobile
|
Regolamento
|
Privacy
FreeForumZone [v.6.1] - Copyright © 2000-2024 FFZ srl -
www.freeforumzone.com
↑
↓
IL MIO PROFILO
LE MIE DISCUSSIONI
FORUM CHE SEGUI
LA MIA FORUM-CARD
MODIFICA FORUM-CARD
FAQ
TRADUCI
LOGOUT
Accedi
Registrati
FAQ
TRADUCI
ACCETTA
RIFIUTA
Anteprima