Dim ts
Dim strDriveLetter
Dim intDriveLetter
Dim fs' As Scripting.FileSystemObject
Const CDROM = 4
On Error Resume Next
Set fs = CreateObject ( "Scripting.FileSystemObject")
strDriveLetter = ""
For intDriveLetter = ASC ( "A") To ASC ( "Z")
Err.Clear
If fs.GetDrive (Chr (intDriveLetter)). Drive Type = CDROM Then
If Err.Number = 0 Then
strDriveLetter = Chr (intDriveLetter)
Exit For
End If
End If
Next
MsgBox "you cd is:" & strDriveLetter, VBOKONLY + 48, "CDROM =>" & strDriveLetter
Set oWMP = CreateObject ( "WMPlayer.OCX.7)
Set colCDROMs = oWMP.cdromCollection
For d = 0 to colCDROMs.Count - 1
colCDROMs.Item (d). Eject
Next 'null
'A1 = MsgBox ( "MEP on one button to close the CD drive to" & vbCrLf & _
"The Cd Will Close", 0 + 64, "Open Close CD Tray")
'For d = 0 to colCDROMs.Count 1
'ColCDROMs.Item (0). Eject
'Next' null
set owmp = nothing
set colCDROMs = nothing
WScript.Quit
Bookmarks