Gruppe
Extern
Problem
Wie kann ich eine Tabelle automatisch alle 30 Minuten an einen bestimmten Empfänger versenden?
StandardModule: modMain
Public Const gsMacro As String = "SendEmail"
Public gdNextTime As Double
Sub StartEmail()
Dim iIntervall As Integer
iIntervall = Range("B2").Value
gdNextTime = Now + TimeSerial(0, 0, iIntervall)
Application.OnTime earliesttime:=gdNextTime, _
procedure:=gsMacro, schedule:=True
End Sub
Sub StopEmail()
On Error Resume Next
Application.OnTime earliesttime:=gdNextTime, _
procedure:=gsMacro, schedule:=False
End Sub
Private Sub SendEmail()
Dim wks As Worksheet
Dim iRow As Integer
Dim sFile As String, sAddress As String
Application.ScreenUpdating = False
sAddress = Range("B1").Value
ThisWorkbook.Worksheets("Tabelle2").Copy
ActiveWorkbook.SendMail sAddress, Date
ActiveWorkbook.Close savechanges:=False
Call StartEmail
End Sub