Link to home
Start Free TrialLog in
Avatar of Sandeman
Sandeman

asked on

Refer to files on CD-ROM

I have a VB project that i want to install on harddisk. When it is installed people can open it in the Startmenu. When they click on a button i want to start a file on the CD-ROM.  How can i refer to the "CD-ROM-files". Most of the times it is D but sometimes it is E or F.
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

I think best you can do is the following: Check which drive is CDRom.
Add "Windows Scripting Host" in Project References.
here some code:
DIM objFSO as Scripting.FileSystemObject
DIM objDrive AS Scripting.Drive

SET objFSP = NEW Scripting.FileSystemObject
FOR EACH objDrive in objFSO.Drives
  IF objDrive.DriveType = "CDRom" THEN
    DEBUG.PRINT objDrive.DriveLetter
  END IF
NEXT

Hope this helps
ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wsh2
wsh2

TWO Excellent solutions.. pick one.. <smile>.

NOTE: Watch your CursorType, CursorLocation and LockEdit when reading MDB data from a CDRom. Your access has to be Exclusive.
Avatar of Sandeman

ASKER

Thank you for your answer Erick. There are only a few who could answer a question as effective as you...