Invia fogli a una o più persone che utilizzano VBA in Microsoft Excel

Sommario

Aggiungi un nuovo foglio, cambia il nome del foglio in posta.
Ogni mail che vuoi inviare utilizzerà 3 colonne.

  1. nella colonna A - inserisci il nome del foglio o dei fogli che vuoi inviare.
  2. nella colonna B - inserisci l'indirizzo e-mail.
  3. nella colonna C - il titolo dell'oggetto viene visualizzato nella parte superiore del messaggio di posta elettronica.

Colonna A:C inserisci le informazioni per la prima mail e puoi usare le colonne D:F per la seconda.
puoi inviare 85 e-mail diverse in questo modo (85*3 = 255 colonne).

 Sub Mail_sheets() Dim MyArr As 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 = da 1 a 253 Passaggio 3 If ThisWorkbook.Sheets("mail" ).Cells(1, a).Value = "" Quindi esci dall'applicazione secondaria.ScreenUpdating = False last = ThisWorkbook.Sheets("mail").Cells(Rows.Count, a).End(xlUp).Row N = 0 Per shname = 1 To last N = N + 1 ReDim Preserve Arr(1 To N) Arr(N) = ThisWorkbook.Sheets("mail").Cells(shname, a).Value Next shname ThisWorkbook.Worksheets(Arr). Copia strdate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss") ActiveWorkbook.SaveAs "Part of" & ThisWorkbook.Name _ & " " & strdate & " .xls" Con 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).Value ActiveWorkbook.ChangeFileAccess xlReadOnly Kill ActiveWorkbook.FullName ActiveWorkbook.Close False Application.ScreenUpdating = True Next a Fine sottotitolo

Aiuterete lo sviluppo del sito, condividere la pagina con i tuoi amici

wave wave wave wave wave