0 pts.
 Super Basic menu program
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

Answer Wiki:
you should find the cd drive letter using vb as shown in the following article http://www.brettb.com/VBScriptDrivesCollection.asp and then use that letter in your program instead of hardcoding as d:
Last Wiki Answer Submitted:  December 15, 2004  8:39 pm  by  Mcp111   0 pts.
All Answer Wiki Contributors:  Mcp111   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Use the Windows API to get the CD Drive letter.

Cheers,

 0 pts.

 

Further to my suggestion to use the Win API, here is some sample code:

http://support.microsoft.com/kb/q180766/

Cheers.

 0 pts.

 

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”)

 0 pts.

 

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.

 0 pts.