1、新建一个模块,把下面的代码粘贴到模块中。
Declare Sub mciSendStringA Lib "winmm.dll" (ByVal lpstrCommand As String, ByVal lpstrReturnString As Any, ByVal uReturnLength As Long, ByVal hwndCallback As Long)
2.调用函数,直接调用下面的代码即可使用 '打开光驱
'mciSendStringA "Set CDAudio Door Open", 0&, 0, 0
'关闭光驱
'mciSendStringA "Set CDAudio Door Closed", 0&, 0, 0