lotustower高手,您深夜还在回贴,我真是感激不尽! 刚按照您的方法,将相应的代码套用在Outlook,另外,我看到现在的生产单号改为B栏,故我也把Excel 里的这句代码Bodytxt = Bodytxt & .Cells(i, "B") & Chr(10)中的B改为了A,但当再打开Outlook时,出现:"编译错误,变数未定义"的对话框。我找来找去,就是不知道哪里出了错,现把套用的代码附上来,麻烦您帮我再看看。多谢! Option Explicit Private Sub Application_Startup() CreateNewAM End Sub Private Sub CreateNewAM() Dim XL_app As Excel.Application Dim XL_wb As Excel.Workbook Dim OLAitem As Outlook.AppointmentItem Dim Bodytxt As String Dim i As Integer Set XL_app = CreateObject("Excel.Application") Set XL_wb = XL_app.Workbooks.Open("E:\OL_Reminder.xls") Bodytxt = "今天到期生產單號" & Chr(10) i = 9 With Sheet4 'With XL_app.Workbooks("OL_Reminder.xls").Sheets(2) Do While .Cells(i, 1) <> "" If Cells(i, 7) = 0 Or Cells(i, 10) = 0 Then ' 0 = 今天到期 Bodytxt = Bodytxt & .Cells(i, "A") & Chr(10) End If i = i + 1 Loop End With On Error GoTo 0 Set OLAitem = CreateItem(olAppointmentItem) '工作 On Error Resume Next With OLAitem .Subject = "今天到期的工作" .Start = Now .End = Now .ReminderMinutesBeforeStart = 30 '30分鐘前提醒 .Body = Bodytxt .Save .Display End With XL_app.ActiveWorkbook.Saved = True XL_app.Workbooks.Close XL_app.QuitSet XL_app = Nothing End Sub
[此贴子已经被作者于2006-3-4 8:46:55编辑过] |