Detecting the drive letter of a user's CD

  • Thread starter Thread starter Charles Jordan
  • Start date Start date
C

Charles Jordan

(Windows XP, Excel 2000). We are endeavouring to open, with IE, a file
called "index.html" which we know is on the users's CD, but we don't
know the drive letter - ie. C:, D:, E:, F: etc. How can we find this ?
is there a wildcard option way of doing it ?

TIA - Charles
 
Charles,

Set a reference (VBA, Tools menu, References) to the Microsoft
Scripting Runtime library, and use code like the following:

Dim FSO As New Scripting.FileSystemObject
Dim Drv As Scripting.Drive
For Each Drv In FSO.Drives
If Drv.DriveType = CDRom Then
Debug.Print Drv.DriveLetter
End If
Next Drv



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Chip Pearson said:
Charles,

Set a reference (VBA, Tools menu, References) to the Microsoft
Scripting Runtime library, and use code like the following:

Dim FSO As New Scripting.FileSystemObject
Dim Drv As Scripting.Drive
For Each Drv In FSO.Drives
If Drv.DriveType = CDRom Then
Debug.Print Drv.DriveLetter
End If
Next Drv



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


Chip - I have been away and only just caught up with my messages.

I never fail to be amazed at the public spirit of you, and your
colleagues on this NG for volunteering your time and knowledge in this
*priceless* way. You may not remember, but I do, how you produced the
code for moving clock hands a year or two back, which has transformed
a key bit of our interactive economics textbook project. If ever you
are in Scotland, I very much hope that you will take the small
additional trouble of contacting me on (e-mail address removed)
so we can hopefully say thank you properly, up here in the Highlands.
For what it's worth, your name also appears in the book's credits, and
extremely well earned too.

Thanks.

Charles
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top