excel2007 vba 自动提醒

做了一个表格,里边有年月日 之后是日程安排,希望有高人能帮忙用VB编写个提示,要求每次打开这个文件能自动弹出对话框,提示这一个星期的日程安排,谢谢

我用VBA写了一个,你参考下吧。呵呵。效果:根据打开文件时的日期,提醒后7天的日程。

实现步骤:在【工程资源管理器】中的【thisworkbook】上双击,在弹出的代码框内写下代码:

Private Sub Workbook_open()
Dim x, i As Integer
Dim thedate As Date
Dim str As String
Dim str1 As String
xr = Cells(65535, 1).End(xlUp).Row
For i = 2 To xr Step 1
thedate = Cells(i, 1).Value
x = DateDiff("d", Now, thedate)
If x <= 7 Then str1 = Cells(i, 1) & ":" & Cells(i, 2) Else str1 = ""
str = str & Chr(10) & str1
Next
MsgBox "最近7天要做的事:" & str
End Sub

温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-09-12
小建议,供参考:直接使用日程安排软件来实现
第2个回答  2013-09-12
这个就用激活事件下面写msgbox就可以了
第3个回答  2013-09-12
你让人家帮你写代码,别人得首先知道你的内容是怎样的才好写。
相似回答