Třeba takto:Sub VZOR_MAIL()
Dim Cesta As String, JmenoSouboru As String
Dim Prijemce As String, Predmet As String, Odpoved As Boolean
Dim pzcx As Long
Cesta = ThisWorkbook.Path
JmenoSouboru = "POKUS_MAIL.xlsx"
Application.DisplayAlerts = False
With Workbooks.Add
For pzcx = .Sheets.Count To 2 Step -1
.Sheets(pzcx).Delete
Next pzcx
.Sheets(1).Name = "MAIL"
ThisWorkbook.Sheets(1).Cells.Copy .Sheets(1).Cells
.SaveAs Cesta & "\" & JmenoSouboru
DoEvents
Prijemce = "kabelpavel@seznam.cz"
Predmet = "Pokus Mail"
Odpoved = False
Workbooks(JmenoSouboru).SendMail Prijemce, Predmet, Odpoved
.Close False
End With
Kill Cesta & "\" & JmenoSouboru
Application.DisplayAlerts = True
End Sub
citovat
Dim Cesta As String, JmenoSouboru As String
Dim Prijemce As String, Predmet As String, Odpoved As Boolean
Dim pzcx As Long
Cesta = ThisWorkbook.Path
JmenoSouboru = "POKUS_MAIL.xlsx"
Application.DisplayAlerts = False
With Workbooks.Add
For pzcx = .Sheets.Count To 2 Step -1
.Sheets(pzcx).Delete
Next pzcx
.Sheets(1).Name = "MAIL"
ThisWorkbook.Sheets(1).Cells.Copy .Sheets(1).Cells
.SaveAs Cesta & "\" & JmenoSouboru
DoEvents
Prijemce = "kabelpavel@seznam.cz"
Predmet = "Pokus Mail"
Odpoved = False
Workbooks(JmenoSouboru).SendMail Prijemce, Predmet, Odpoved
.Close False
End With
Kill Cesta & "\" & JmenoSouboru
Application.DisplayAlerts = True
End Sub
citovat