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
Code
Dim lngReturn As Long Dim strReturn As Long 'To open the CD door, use this code: lngReturn = mciSendString("set CDAudio door open", strReturn, 127, 0) 'To close the CD door, use this code: lngReturn = mciSendString("set CDAudio door closed", strReturn, 127, 0)