Identify CD-Rom drive
If for some reason you want to keep it simple this might be an option:
It is based on the fact that you can't write to a CD-ROM.
Function FindFirstReadOnlyDriveAfterC() As String
Dim i As Byte
On Error GoTo ERROROUT
For i = 68 To 90
StringToTextFile Chr(i) & ":\zxzx.txt", "test"
Kill Chr(i) & ":\zxzx.txt"
Next
ERROROUT:
FindFirstReadOnlyDriveAfterC = Chr(i)
End Function
Sub StringToTextFile(ByVal txtFile As String, _
ByVal strString As String)
Dim hFile As Long
hFile = FreeFile
Open txtFile For Output As hFile
Write #hFile, strString
Close #hFile
End Sub
Sub test()
MsgBox FindFirstReadOnlyDriveAfterC()
End Sub
RBS
"MD" wrote in message
. ..
Using FileCopy, I'd like to copy a file from a CD-Rom that is always in
the
same folder to the hard drive.
Sub TranferFiles()
SourceFile = "E:\folder\MyFile.doc"
DestinationFile = "C:\Temp\MyFile.doc"
FileCopy SourceFile, DestinationFile
End Sub
One problem with this....The CD-Rom drive is not always E from one PC to
the
other. So how do I identify the CD-Rom drive so that my code looks like
CD_Drive = ???????
SourceFile = CD_Drive + "\folder\MyFile.doc"
Regards!
Michel
|