VB4,5 and 6 Code module equivalent that requires no external ActiveX dependencies.
Option Explicit
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Public Sub CloseCD()
Dim Lngreturn As Long
Dim Strreturn As Long
Lngreturn = mciSendString("set CDAudio door closed", Strreturn, 127, 0)
End Sub
Public Sub OpenCD()
Dim Lngreturn As Long
Dim Strreturn As Long
Lngreturn = mciSendString("set CDAudio door open", Strreturn, 127, 0)
End Sub
There are other MCI commands that could be executed, including opening a sequencer and playing CD audio, seeking, etc. However I haven't used MCI for a very long time.