Hallo iedereen, ik heb een makro (van Ron De Bruin) om een werkblad te mailen, maar in dit werkblad staat ook een afbeelding (logo), de makro werkt perfect alleen zend hij de afbeelding niet mee. Weet iemand hoe ik de makro moet aanpassen zodat de afbeelding wel wordt mee verzonden?
Hieronder de makro.
Alvast bedankt!
Hieronder de makro.
Code:
Sub Mail_Range2()
'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
Dim MAddress As String
Set Source = Nothing
On Error Resume Next
Set Source = Range("A1:I50").SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Source Is Nothing Then
MsgBox "De bron is niet in berijk, " & _
"verbeter en probeer opnieuw.", vbOKOnly
Exit Sub
End If
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set wb = ActiveWorkbook
On Error Resume Next
MAddress = Application.WorksheetFunction.VLookup(Range("b10").Value, Sheets("klantelijst").Range("A:I"), 9, False)
On Error GoTo 0
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
End With
TempFilePath = Environ$("temp") & "\"
TempFileName = "Range 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 MAddress, _
"offerte-bestelling stad Antwerpen"
If Err.Number = 0 Then Exit For
Next I
On Error GoTo 0
.Close SaveChanges:=False
End With
'Delete the file you have send
Kill TempFilePath & TempFileName & FileExtStr
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
Alvast bedankt!
Laatst bewerkt door een moderator: