LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Changing drive letter in VBA


"zhj23" wrote:

Thanks for the various suggestions. I would look into them.

zhj23.

"zhj23" wrote:

For mobility reasons, I store all my VBA programmes in a thumb drive (USB).
And in some of my VBA programmes, also contain the drive path with the
associated drive letters. (e.g. opening a file)

As I add more USB devices to my PC, these drive letters keep changing such
that the VBA programme can't read the correct drive letter where the files
are stored.

Any solution to fix the drive letter? Thanks.

zhj23


Maybe you could also try naming your USB drives and then getting the drive
letter:

Sub getUSBDrive()

Set fso = CreateObject _
("Scripting.FileSystemObject")

For Each drive In fso.Drives

If drive.IsReady Then
If UCase(drive.VolumeName) = "MYUSBDRIVE" Then
Debug.Print drive.VolumeName, drive.DriveLetter
End If
End If

Next

End Sub


--
urkec


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Obtain drive letter assignment of CD/DVD drive? EagleOne Excel Discussion (Misc queries) 1 October 13th 06 01:27 PM
changing drive letter in custom macro toolbar buttons Govt Guy Excel Programming 3 September 23rd 05 07:35 PM
Help to Indentify a drive letter Grandad Excel Programming 12 August 6th 04 08:50 PM
Using path instead of drive letter dumbass Excel Programming 2 May 25th 04 12:25 AM
How to find the drive letter? Mervyn Thomas Excel Programming 8 January 31st 04 01:11 PM


All times are GMT +1. The time now is 11:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"