Dodajte novi list, promijenite naziv lista u mail.
Svaki mail koji želite poslati koristit će 3 stupca.
- u stupac A - unesite naziv lista ili listova koje želite poslati.
- u stupac B - upišite adresu e -pošte.
- u stupcu C - naslov teme pojavljuje se pri vrhu poruke e -pošte.
U stupac A: C unesite podatke za prvu poštu, a za drugu možete koristiti stupce D: F.
na ovaj način možete poslati 85 različitih e-poruka (85*3 = 255 stupaca).
Sub Mail_sheets () Dim MyArr Kao Variant Dim last As Long Dim shname As Long Dim a As Integer Dim Arr () As String Dim N As Integer Dim strdate As String For a = 1 To 253 Step 3 If ThisWorkbook.Sheets ("mail" ) .Cells (1, a) .Value = "" Zatim zatvorite pomoćnu aplikaciju.ScreenUpdating = False last = ThisWorkbook.Sheets ("pošta"). Cells (Rows.Count, a) .End (xlUp) .Row N = 0 Za shname = 1 Za posljednje N = N + 1 ReDim Preserve Arr (1 To N) Arr (N) = ThisWorkbook.Sheets ("mail"). Cells (shname, a) .Vrednost Next shname ThisWorkbook.Worksheets (Arr). Kopiraj strdate = Format (Date, "dd-mm-yy") & "" & Format (Time, "h-mm-ss") ActiveWorkbook.SaveAs "Dio" & ThisWorkbook.Name _ & "" & strdate & " .xls "With ThisWorkbook.Sheets (" mail ") MyArr = .Range (.Cells (1, a + 1), .Cells (Rows.Count, a + 1) .End (xlUp)) End with ActiveWorkbook.SendMail MyArr , ThisWorkbook.Sheets ("mail"). Cells (1, a + 2) .Vrijednost ActiveWorkbook.ChangeFileAccess xlReadOnly Kill ActiveWorkbook.FullName ActiveWorkbook.Close False Application.ScreenUpdating = True Next a Kraj podm