Ciao Giovanni,
Salve,
ho bisogno di mandare una mail aziendali a più clienti, ho un elenco delle mail in formato excel e volevo sapere se c'era modo, con qualche automatismo, di inviarla senza copiare ed incollare tutti gli indirizzi a mano.
Ho office 2016
Supponiamo che i tuoi dati siano presentati in una tabella del seguente tipo:

In assenza di ulteriori dettagli prova qualcosa del genere:
- Alt+F11 per aprire l'editor di VBA
- Alt+IM per inserire un nuovo modulo di codice
- Nel nuovo modulo vuoto, incolla il seguente codice:
'=========>>
Option Explicit
'--------->>
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng As Range, rCell As Range
Dim oOutlook As Object
Dim oMail As Object
Dim LRow As Long
Dim i As Long
Const sFoglio As String = "Foglio1" '<<=== Modifica
Const sSoggetto As String = "Nuovo prodotto" '<<=== Modifica
Set WB = ThisWorkbook
Set SH = WB.Sheets(sFoglio)
With SH
LRow = LastRow(SH, .Columns("A:A"))
Set Rng = .Range("A2:B" & LRow)
End With
Application.ScreenUpdating = False
Set oOutlook = CreateObject("Outlook.Application")
For Each rCell In Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If rCell.Value Like "?*@?*.?*" Then
Set oMail = oOutlook.CreateItem(0)
On Error Resume Next
With oMail
.To = rCell.Value
.Subject = sSoggetto
.Body = "Spett. " & rCell.Offset(0, 1).Value _
& vbNewLine & vbNewLine _
& "il tuo messagio"
.Display 'Send
End With
On Error GoTo 0
Set oMail = Nothing
End If
Next rCell
XIT:
Set oOutlook = Nothing
Application.ScreenUpdating = True
End Sub
'--------->>
Public Function LastRow(SH As Worksheet, _
Optional Rng As Range, _
Optional minRow As Long = 1, _
Optional sPassword As String)
Dim bProtected As Boolean
With SH
If Rng Is Nothing Then
Set Rng = .Cells
End If
bProtected = .ProtectContents = True
If bProtected Then
.Unprotect Password:=sPassword
End If
End With
On Error Resume Next
LastRow = Rng.Find(What:="*", _
after:=Rng.Cells(1), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
If LastRow < minRow Then
LastRow = minRow
End If
If bProtected Then
SH.Protect Password:=sPassword, _
UserInterfaceOnly:=True
End If
End Function
'<<=========
- Alt+Q per chiudere l'editor di VBA e tornare a Excel
- Salva il file con l’estensione xlsm
- Alt+F8 per aprire la finestra di gestione delle macro
- Seleziona Tester
- Esegui
Potresti scaricare il mio file di prova Giovanni20191010.xlsm
===
Regards,
Norman
