excel打开和关闭光驱的宏代码
时间:2022-10-23 22:57:25
用下面的宏代码可以打开或关闭电脑中默认的光驱。方法是:
1.按Alt+F11打开VBA编辑器。
2.在代码窗口中输入下列代码:
Private Declare Sub mciSendStringA Lib "winmm.dll" (ByVal lpstrCommand As String, _
ByVal lpstrReturnString As Any, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long)
Sub OpenDefaultCDDVD()
‘打开光驱
mciSendStringA "Set CDAudio Door Open", 0&, 0, 0
End Sub
Sub CloseDefaultCDDVD()
‘关闭光驱
mciSendStringA "Set CDAudio Door Closed", 0&, 0, 0
End Sub
标签:代码,光驱,关闭,打开,Excel函数
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Win10精简版_俄罗斯大神Win10 64位精简版
2023-10-29 16:08:34
![](https://img.aspxhome.com/file/2023/30/a265697_0s.jpg)
如何添加Excel下拉菜单?
2022-05-23 21:12:44
![](https://img.aspxhome.com/file/2023/7/a153647_0s.jpg)
excel2003按内容分类的教程
2023-05-08 08:01:52
电脑版WPS怎么批量设置数字字号
2023-08-18 07:24:37
![](https://img.aspxhome.com/file/2023/2/a183352_0s.jpg)
excel如何查找同类项
2022-02-20 09:03:21
![](https://img.aspxhome.com/file/2023/2/36842_0s.jpg)
如何使用ai设计打开的金锁图标 ai设计打开的金锁图标的具体教程
2023-06-28 03:05:44
win10玩剑灵闪退怎么办?
2023-10-20 08:47:07
![](https://img.aspxhome.com/file/2023/1/a278065_0s.png)
如何用搜狗拼音输入法快速打出自定义的句子
2023-06-11 06:03:06
![](https://img.aspxhome.com/file/2023/5/a317562_0s.jpg)
Win7系统怎么设置输入法?
2022-07-17 10:46:31
![](https://img.aspxhome.com/file/2023/5/a313952_0s.png)
win7环境下成功使用system账号执行cmd
2022-12-29 12:50:24
Word中2007版进行设置除首页外页面都有页眉的方法
2023-08-10 05:23:14
Excel 如何快速汇总大数据求和(普通透视表法)
2022-02-18 10:42:11
![](https://img.aspxhome.com/file/2023/8/a155268_0s.jpg)
Word中用插入符号功能快速输入生僻字技巧
2022-08-19 18:43:27
![](https://img.aspxhome.com/file/2023/2/20782_0s.jpg)
focusky新手制作教程
2023-10-13 17:01:06
![](https://img.aspxhome.com/file/2023/1/a283559_0s.png)
Windows 10 PowerToys首次预览推出
2022-05-01 18:47:57
![](https://img.aspxhome.com/file/2023/2/a289119_0s.png)
WPS如何高效设置相同字体格式
2022-10-02 02:21:42
![](https://img.aspxhome.com/file/2023/1/a186831_0s.jpg)
Word2010如何设置自动保存
2023-12-01 13:50:30
![](https://img.aspxhome.com/file/2023/9/19389_0s.jpg)
地震预警如何使用?地震预警使用方法
2022-06-09 04:16:50
![](https://img.aspxhome.com/file/2023/8/a333370_0s.jpg)
赛博朋克2077如何快速破解组件?赛博朋克2077快速破解组件获得方法
2023-08-05 05:32:02
![](https://img.aspxhome.com/file/2023/6/a324725_0s.jpg)
excel数字怎么自动往下接
2022-03-20 08:17:29
![](https://img.aspxhome.com/file/2023/8/36618_0s.jpg)