Hallo iedereen,
Ik heb een macro om een excelblad te mailen, wat ik wil wijzigen is dat in de body van de mail mijn adres gegevens ect. verschijnt. Weet iemand hoe ik deze macro moet wijzigen?
Alvast bedankt.
Ik heb een macro om een excelblad te mailen, wat ik wil wijzigen is dat in de body van de mail mijn adres gegevens ect. verschijnt. Weet iemand hoe ik deze macro moet wijzigen?
Alvast bedankt.
Code:
Sub Mail_body()
'Working in 2000-2010
Dim Source As Range
Dim Dest As Workbook
Dim wb As Workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String
Dim FileFormatNum As Long
Dim I As Long
Set Source = Nothing
On Error Resume Next
Set Source = Range("A1:g50").SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Source Is Nothing Then
MsgBox "The source is not a range or the sheet is protected, please correct and try again.", vbOKOnly
Exit Sub
End If
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set wb = ActiveWorkbook
Set Dest = Workbooks.Add(xlWBATWorksheet)
Source.Copy
With Dest.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial Paste:=xlPasteValues
.Cells(1).PasteSpecial Paste:=xlPasteFormats
.Cells(1).Select
Application.CutCopyMode = False
Set rng = .Range("A1") 'Wijzig hier naar de juiste cel
Set pic = .Pictures.Insert("E:\AAAVMH\logonA.scr") 'Pas hier het pad naar je afbeelding aan
If Not pic Is Nothing Then
With pic
.Height = 60
.Width = 120
.Left = rng.Left
.Top = rng.Top
.Placement = xlMoveAndSize
End With
End If
TempFilePath = Environ$("temp") & "\"
TempFileName = "Selection of " & wb.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss")
If Val(Application.Version) < 12 Then
'You use Excel 2000-2003
FileExtStr = ".xls": FileFormatNum = -4143
Else
'You use Excel 2007-2010
FileExtStr = ".xlsx": FileFormatNum = 51
End If
With Dest
.SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
On Error Resume Next
For I = 1 To 3
.SendMail "", _
" "
If Err.Number = 0 Then Exit For
Next I
On Error GoTo 0
.Close SaveChanges:=False
End With
Kill TempFilePath & TempFileName & FileExtStr
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End With
End Sub
Laatst bewerkt: