|
-
Apr 8th, 2003, 04:15 PM
#1
Thread Starter
Junior Member
code to run file from user's CD drive
I have an Excel file and iview32.exe I am going to put on a CD.
I use this code to find what drive user utilizes (and it works):
DriveID = Application.ActiveWorkbook.Path
While testing from my HD, I have this code to activate iview32.exe (and it works):
Shell "D:/Program Files\Irfanview\i_view32.exe /slideshow=C:\a.txt", vbNormalFocus
After I put all on CD, I will need to modify above to reflect path on CD like so:
Shell DriveID (User's CD Drive)& ":" & "\" (Concatenate this)Irfanview\iview32.exe /slideshow=C:\a.txt", vbNormalFocus (Path on CD)
Tried it, but can't get parens () and Quotes " and & in right places.
-
Apr 8th, 2003, 04:36 PM
#2
Addicted Member
i don't know if this is right but here goes nothing
DriveID = Application.ActiveWorkbook.Path
Shell DriveID & ":\Irfanview\iview32.exe /slideshow=C:\a.txt", vbNormalFocus
-
Apr 8th, 2003, 04:41 PM
#3
Frenzied Member
This will show you all available cd-rom drives. Adopt it to your code.
VB Code:
Private Declare Function GetDriveType Lib "kernel32" _
Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Sub Command1_Click()
Dim drive
For i = 65 To 90
drive = Chr(i) & ":\"
If GetDriveType(drive) = 5 Then MsgBox "CD-ROM Found! Drive - " & drive
Next i
End Sub
-
Apr 8th, 2003, 04:48 PM
#4
Frenzied Member
This just for fun. You may need it:
VB Code:
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
Private Sub cmdCloseCupHolder_Click()
mciSendString "set CDAudio door closed", 0, 127, 0
End Sub
Private Sub cmdOpenCupHolder_Click()
mciSendString "set CDAudio door open", 0, 127, 0
End Sub
-
Apr 8th, 2003, 09:23 PM
#5
Thread Starter
Junior Member
Aldinator:
I tried your suggestion and it worked like a charm!
Thanks to all who responded
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|