Dear lotustower,您好!是不是原来的EXCEL里的代码也要相应改一下?因原来对应的是1个SHEET,现在对应的是2个SHEET,下面是EXCEL里的代码。
Sub ListmatureItem()
Dim OLapp As Outlook.Application
Dim OLAitem As Outlook.AppointmentItem
Bodytxt = "今天到期生產單號" & Chr(10)
i = 9
With Sheet1
Do While .Cells(i, "L") <> ""
If CDate(.Cells(i, "L")) = Date Then
Bodytxt = Bodytxt & .Cells(i, "B") & Chr(10)
End If
i = i + 1
Loop
End With
On Error Resume Next
Set OLapp = GetObject(, "Outlook.Application")
If Err.Number Then
Err.Clear
Set OLapp = CreateObject("Outlook.Application")
End If
On Error GoTo 0
Set OLAitem = OLapp.CreateItem(olAppointmentItem) '工作
On Error Resume Next
With OLAitem
.Subject = "今天到期的工作"
.Start = Now
.End = Now
.ReminderMinutesBeforeStart = 30 '30分鐘前提醒
.Body = Bodytxt
.Save
.Display
End With
Set OLcont = Nothing
Set OLapp = Nothing
End Sub |