如何给Excel工作簿添加定时提醒功能
时间:2023-06-01 18:08:00
我们在编辑Excel工作表的过程中,如果有某个重要的事情需要在某一时间去完成,例如要在16:40分打个电话,或将报表交给部门经理等,为了避免遗忘,可以用VBA给工作簿添加一个定时提醒功能。方法如下:
1.打开工作簿,按快捷键Alt+F11,打开VBA编辑器。
2.单击菜单“插入→模块”,Excel将插入一个名称为“模块1”的模块。
3.在右侧代码窗口中粘贴下列代码:
Private Declare Function sndPlaySound32 _
Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Sub Auto_Open()
Application.OnTime TimeValue("16:40:00"), "DisplayAlarm" ‘第一次提醒
Application.OnTime TimeValue("16:40:30"), "DisplayAlarm" ‘隔30秒第二次提醒
End Sub
Sub DisplayAlarm()
sndPlaySound32 ThisWorkbook.Path & "\DRBELL.wav", 0&
MsgBox (" 到时间了!")
End Sub
说明:上述代码用Auto_Open宏在工作簿打开时自动执行提醒代码。共设置了两次提醒,提醒时间分别为“16:40:00”和“16:40:30”,可以将该时间修改为所需的时间。提醒的方式为声音提醒和消息框提醒,声音文件为“DRBELL.wav”,需将该声音文件放置在工作簿所在文件夹中。本文结尾处提供示例文件下载,其中包含该声音文件。
4.保存并关闭工作簿,然后重新打开工作簿。当到达设置的时间后,Excel会给出一个声音提示,同时弹出一个消息框。这下就再也不用担心忘记时间了。
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Win7系统 验证localhost文件状态的操作方法
![](https://img.aspxhome.com/file/2023/29/a251199_0s.jpg)
excel2013如何添加修改图表标题
![](https://img.aspxhome.com/file/2023/1/36421_0s.jpg)
excel中提取汉字的三种高效快捷技巧 excel利用函数公式提取汉字
![](https://img.aspxhome.com/file/2023/0/a162190_0s.jpg)
升级 iOS 系统时卡住怎么办?
![](https://img.aspxhome.com/file/2023/3/a197913_0s.jpg)
windows7系统怎么卸载已经安装的程序(图文教程)
![](https://img.aspxhome.com/file/2023/29/a257688_0s.jpg)
PPT图表美化教程 PPT图表变形计:简单几步让图表变好看!
![](https://img.aspxhome.com/file/2023/10/a351811_0s.png)
通过 OTA 升级时,长时间显示“估算剩余时间”是什么原因?
![](https://img.aspxhome.com/file/2023/6/a197046_0s.jpg)
微信如何将成员踢出微信群?
![](https://img.aspxhome.com/file/2023/8/a339709_0s.jpg)
win10双系统怎么删除一个?如何删除电脑双系统中的一个
![](https://img.aspxhome.com/file/2023/1/a271807_0s.png)
PPT中怎么单独裁剪太阳的后裔中宋钟基的图片?
![](https://img.aspxhome.com/file/2023/10/a346845_0s.jpg)
Vivaldi浏览器如何设置必应为默认搜索引擎
![](https://img.aspxhome.com/file/2023/9/a341481_0s.png)
电脑版wps文档如何设置页边距
![](https://img.aspxhome.com/file/2023/9/a183399_0s.png)
在excel表格中如何在数据前或数据后加入0?
![](https://img.aspxhome.com/file/2023/7/41277_0s.jpg)
wps表格怎么添加页眉下划线
OFFice2003只能以安全模式启动的问题的解决方法
fsmb32.exe是什么进程 作用是什么 fsmb32进程查询
PPT图片 魔术方块 效果实现教程
搭载M1芯片的Mac软件兼容性怎么样?
![](https://img.aspxhome.com/file/2023/9/a209289_0s.png)
excel 获取唯一值的多种方法:分别用函数、技巧、透视、VBA多种方法实现取唯一值
![](https://img.aspxhome.com/file/2023/0/a162640_0s.gif)
win10音频服务不响应怎么办?win10音频服务不响应的解决方法
![](https://img.aspxhome.com/file/2023/4/a304910_0s.png)