I haven't used VB in forever but I'm trying to create a simple program. I'm going to run program along with a couple of other files on a CD. I've created two buttons, the 1st to open a file and the 2nd to open a different open. I'm using a call shell command but if the cd rom drive letter is different from d: it will error out. What are my options???
Software/Hardware used:
ASKED:
December 15, 2004 8:08 PM
UPDATED:
December 16, 2004 7:14 PM
Use the Windows API to get the CD Drive letter.
Cheers,
Further to my suggestion to use the Win API, here is some sample code:
http://support.microsoft.com/kb/q180766/
Cheers.
Ok, I’m going to really show my ignorance, but what command am I going to use select the cd rom drive it and run the file i need i.e (call shell %CDROM_DRIVE%”:test.txt”)
Let’s assume you found the cd-rom drive letter using a VBA program shown in this link
http://support.microsoft.com/kb/q180766/
The variable strDriveletter now contains the drive letter.
Then you would write
shell(“c:windowsnotepad.exe ” + strdriveletter + “:test.txt) to open the test.txt in notepad.