Ik heb me rot gezocht en uitgeprobeerd (o.a on de bruin) voor een mogelijkheid om zowel
een geselecteerd gebied in excel te versturen maar om aan dat bericht ook nog extra tekst aan toe te voegen wil me maar niet lukken.
Tot nu toe heb ik onderstaande, hoe krijg ik nu de rest in de mail?
een geselecteerd gebied in excel te versturen maar om aan dat bericht ook nog extra tekst aan toe te voegen wil me maar niet lukken.
Tot nu toe heb ik onderstaande, hoe krijg ik nu de rest in de mail?
Code:
Sub Mail_Send_Selection_Or_Range_Body()
Dim rng As Range
Dim iMsg As Object
Dim iConf As Object
Dim Flds As Variant
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "xxx.xx.nl"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
Set rng = Nothing
On Error Resume Next
Set rng = Selection.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
With iMsg
Set .Configuration = iConf
.to = "mijn.email@gmail.com"
.CC = ""
.BCC = ""
.From = """mijn persoontje"" mijn.email@gmail.com"
'.Subject = "Selectie uit Excel Bestand"
'.Subject = "Test van mij"
.Subject = ActiveSheet.Range("A15")
.HTMLBody = RangetoHTML(rng)
[COLOR="#FF0000"] .TextBody = "Beste Leverancier, " & vbCrLf & vbCrLf & _
"Hierbij ontvangt u een overzicht van order" & "" & ActiveSheet.Range("C2").Text & vbCrLf & vbCrLf & _
"Van deze order is een deel niet geleverd." & vbCrLf & vbCrLf & _
"Volgens onze gegevens hebben wij hierover geen bericht ontvangen." & vbCrLf & vbCrLf & _
"Wilt u ons hierover zsm informeren?" & vbCrLf & vbCrLf & _
"met vriendelijk groet," & vbCrLf & _
"mijn persoon."[/COLOR]
.Send
End With
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub