Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open CD Rom drive command

Status
Not open for further replies.

C0PP3R

Programmer
Jun 27, 2002
64
CA
I'm wondering if anyone knows of a command in VBA in access that you can use to automatically eject the CD ROM-drive of the computer it's running on. Or if it's a dos command that could be called from access, I know the command exists in windows, any help would be muchly appreciated.

Thanx

Copper
 
This can be done, here is the coding,


Opens the tray

Sub OpenCDTray()
mciSendStringA "Set CDAudio Door Open", 0&, 0, 0
End Sub

Close the Tray

Sub auto_close()
mciSendStringA "Set CDAudio Door Closed", 0&, 0, 0
End Sub
 
OOps forgot some code, you need to add this in as well.

Declare Sub mciSendStringA Lib "winmm.dll" (ByVal lpstrCommand As String, _
ByVal lpstrReturnString As Any, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top