Moderatori: Anthony47, Flash30005
Sub VerifData()
If Date >= Range("Cxx").value then
'macro invio email
endif
End SubSub VerifData()
If Date >= Range("Cxx").value and range("Zxx").value = "" then
'macro invio email
range("Zxx").value = 1
endif
End SubSub SendList()
'Crea copia del foglio in Temp
ActiveSheet.Copy
TempFile = Environ$("temp") & "\ciccio.xls" 'Salva in Temp un file pippozczc.xls
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=TempFile, _
FileFormat:=xlExcel8, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Application.DisplayAlerts = True
Workbooks("ciccio.xls").Close savechanges:=False
'
'Codice per l' invio email
Dim OutApp As Object
Dim OutMail As Object
Dim EmailAddr As String
Dim Subj As String
Dim BodyText As String
'
EmailAddr = "aaa@dominio.it"
'
' (a)
Set OutApp = CreateObject("Outlook.Application")
''compilazione di un testo standard di accompagnamento
BDT = "Elenco prodotti in scadenza"
BDT = BDT & vbCrLf & "Cordiali saluti" & vbCrLf
BDT = BDT & "CiccioILpacco"
'' (b)
'Nominat = Sheets("Scheda").Range("C5").Value
OutFile = Environ$("temp") & "\ciccio.xlsSubj = "Prodotti Magazzino"
Set OutMail = OutApp.CreateItem(0) With OutMail
.To = "bbb@dominio.it"
.CC = ""
.BCC = ""
.Subject = Subj
.Attachments.Add OutFile
.Body = BDT
.Display 'or use .send
'.send
End With
' (c)
Set OutMail = Nothing
'
' (d)
Set OutApp = Nothing
Application.Wait (Now + TimeValue("0:00:04"))
Application.SendKeys "%a"
Application.Wait (Now + TimeValue("0:00:04"))
(Nominat = Sheets("Scheda").Range("C5").Value)
Set OutApp = Nothing
Application.Wait (Now + TimeValue("0:00:04"))
Application.SendKeys "%a"
Application.Wait (Now + TimeValue("0:00:04"))
Sub VerifData()
UR = Range("D" & Rows.Count).End(xlUp).Row
For RR = 4 To UR
If Date >= Range("D" & RR).Value - Range("E" & RR).Value And Range("F" & RR).Value = "" Then
'macro invio email <<<< qui richiamerai la tua macro di invio email
Range("F" & RR).Value = "Inviata"
End If
Next RR
End SubIf Date >= Range("D" & RR).Value - 5 And Range("F" & RR).Value = "" Then
If Date >= Range("D" & RR).Value - [O5] And Range("F" & RR).Value = "" Then
Sub SendList()
'Crea copia del foglio in Temp
ActiveSheet.Copy
TempFile = Environ$("temp") & "\ciccio.xls"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=TempFile, _
FileFormat:=xlExcel8, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Application.DisplayAlerts = True
Workbooks("ciccio.xls").Close savechanges:=False
'
Sub VerifData()
UR = Range("D" & Rows.Count).End(xlUp).Row
For RR = 4 To UR
If Date >= Range("D" & RR).Value - 1 And Range("F" & RR).Value = "" Then
'macro invio email <<<< qui richiamerai la tua macro di invio email
'Codice per l' invio email
Dim OutApp As Object
Dim OutMail As Object
Dim EmailAddr As String
Dim Subj As String
Dim BodyText As String
'
EmailAddr = "nome@dominio.it"
'
' (a)
Set OutApp = CreateObject("Outlook.Application")
''compilazione di un testo standard di accompagnamento
BDT = "Si trasmette l' elenco dei prodotti in scadenza"
BDT = BDT & vbCrLf & "Cordiali saluti" & vbCrLf
BDT = BDT & "Ciccio"
'' (b)
'Nominat = Sheets("Scheda").Range("C5").Value
OutFile = Environ$("temp") & "\ciccio.xls"
Subj = "Elenco prodotti in scadenza"
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = EmailAddr
.CC = ""
.BCC = ""
.Subject = Subj
.Attachments.Add OutFile
.Body = BDT
.Display 'or use .send
'.send
End With
' (c)
Set OutMail = Nothing
'
' (d)
Set OutApp = Nothing
Application.Wait (Now + TimeValue("0:00:04"))
Application.SendKeys "%a"
Application.Wait (Now + TimeValue("0:00:04"))
'
End Sub
Range("F" & RR).Value = "Inviata"
End If
Next RR
End Sub

Sub Auto_apri()
Dim OutApp As Object
Dim OutMail As Object
Dim EmailAddr As String
Dim Subj As String
Dim BodyText As String
If Date = Range("D1").Value = Range("F1").Value = "" Then
End If
EmailAddr = Range("i2").Value '<<< inserire indirizzi
Subj = "nota n° " & Range("j4") & " del " & Range("j6").Value
BodyText = "In allegato ."
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.to = EmailAddr
.CC = ""
.BCC = ""
.Subject = Subj
.Body = BodyText
.Attachments.Add ActiveWorkbook.FullName 'inserisce il file excel in allegato
.Send 'or use .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
If Date = Range("D1").Value = Range("F1").Value = "" Then Exit SubSub VerifData()
UR = Range("D" & Rows.Count).End(xlUp).Row
For RR = 4 To UR
MsgBox Date & " " & Range("D" & RR).Value - Range("E" & RR).Value
If Date >= Range("D" & RR).Value - Range("E" & RR).Value And Range("F" & RR).Value = "" Then
Pippo '<<<<< qui devi scrivere il nome della tua macro di invio email
Range("F" & RR).Value = "Inviata"
End If
Next RR
End Sub
BodyText = Join(WorksheetFunction.Transpose(Range("L1:L10")), " ")Torna a Applicazioni Office Windows
| Supporto per sviluppo macro VBA Ordinare per data Autore: Carletto Ribolla |
Forum: Applicazioni Office Windows Risposte: 3 |
| Eliminare righe diverse dalla prima data del mese Autore: dipdip |
Forum: Applicazioni Office Windows Risposte: 4 |
| Problemi di ricezione Mail su outlook Autore: danibi60 |
Forum: Applicazioni Office Windows Risposte: 2 |
Visitano il forum: Nessuno e 16 ospiti