HammerJohn
Gebruiker
- Lid geworden
- 27 apr 2016
- Berichten
- 173
Ik heb een macro om een werkblad te versturen....... maar bij onder werp geeft hij ??<<
en ik kan het niet vinden.
Misschien iemand een oplossing?????
en ik kan het niet vinden.
Code:
Sub Mail_Sheets()
'Working in Excel 2000-2016
Dim wb As Workbook
Dim Shname As Variant
Dim Addr As Variant
Dim N As Integer
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String
Dim FileFormatNum As Long
Dim I As Long
Shname = Array("Hoofdbestand")
Addr = Array("xxxxxxx@gmail.com")
If Val(Application.Version) >= 12 Then
'You run Excel 2007-2016
FileExtStr = ".xlsm": FileFormatNum = 52
Else
'You run Excel 97-2003
FileExtStr = ".xls": FileFormatNum = -4143
End If
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
TempFilePath = Environ$("temp") & ""
'Create the new workbooks/Mail it/Delete it
For N = LBound(Shname) To UBound(Shname)
TempFileName = "Sheet " & Shname(N) & " " & Format(Now, "dd-mmm-yy")
ThisWorkbook.Sheets(Shname(N)).Copy
Set wb = ActiveWorkbook
With wb
.SaveAs TempFilePath & TempFileName & FileExtStr, FileFormatNum
On Error Resume Next
For I = 1 To 3
.sendmail Addr(N), _
.Subject = "test"
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
Next N
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
Misschien iemand een oplossing?????
Laatst bewerkt: