の自動メールを送信:は、私がコード持っているループ
をアイテムが移動または削除されました:それは最初の電子メールを送信し
Sub sendEmail() Dim OutlookApp As Object Dim OutlookItem As Object Dim i As Integer Dim Address As String Set OutlookApp = CreateObject("Outlook.Application") Set OutlookItem = OutlookApp.CreateItem(0) With OutlookItem For i = 4 To 15 If Cells(i, 18) <= Cells(i, 6) Then Address = Cells(i, 14).Value Set OutlookApp = CreateObject("Outlook.application") Set OutlookItem = OutlookApp.CreateItem(0) .To = Address .Subject = "Calibration Due Soon !!!" .Body = "Reminder: Calibration of " & Cells(i, 4) & "is due on " & Cells(i, 9) .Send Set OutlookItem = Nothing Set OutlookApp = Nothing 'Application.Wait (Now + #12:00:08 AM#) ElseIf Cells(i, 18) > Cells(i, 15) Then Exit Sub ElseIf Cells(i, 18) = "" And Cells(i, 15) = "" Then Exit Sub End If Next i End With End Sub
を、それは言って実行時エラーを私に求められます
デバッガでは、 ".To = Address"行が強調表示されます。 送信の代わりに.Displayを使用すると動作します。 アイデア
?それはひどく非効率的ですね。 – Tomalak