The following code when placed in a standard module creates two separate macros to open and close a CD tray.
Any help would be kindly appreciated if this code could be changed so that one macro button does both the tasks.
Meaning, if the macro button is clicked the CD tray closes if its open and opens if it is closed.
Thanks in advance.
Code: Select all
Declare Sub mciSendStringA Lib "winmm.dll" (ByVal lpstrCommand As String, _
ByVal lpstrReturnString As Any, ByVal uReturnLength As Long, _
ByVal hWndCallback As Long)
Sub OpenCDTray()
mciSendStringA "Set CDAudio Door Open", 0&, 0, 0
End Sub
Sub CloseCDTray()
mciSendStringA "Set CDAudio Door Closed", 0&, 0, 0
End Sub
Code: Select all
Declare Sub mciSendStringA Lib "winmm.dll" (ByVal lpstrCommand As String, _
ByVal lpstrReturnString As Any, ByVal uReturnLength As Long, _
ByVal hWndCallback As Long)
Sub OpenAndCloseCDTray()
mciSendStringA "Set CDAudio Door Open", 0&, 0, 0
mciSendStringA "Set CDAudio Door Closed", 0&, 0, 0
End Sub