UNC equivalent path for flash drives

KGee

Well-known Member
Joined
Nov 26, 2008
Messages
539
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Does such a thing exist? We want to be specify a flash drive by the actual name of the device as opposed to the drive letter which may vary depending on which computer the drive is connected to.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Sadly no. You could try something like having a Macro which finds out which driver letter the flash drive is on today.

Which then modifies the formulas (Which I assume is what you are referencing the drive letter in?) to have the correct drive letter.

You can run a Macro when you open the spreadsheet adding code to Workbook_Open

Getting the drive letter you could use something like:
Code:
flashDriveName = "Label of my Flash Drive"
flashDriveLetter = "?"

Set fs = CreateObject("Scripting.FileSystemObject")
Set dc = fs.Drives
For Each d In dc
    If d.IsReady Then
        If d.VolumeName = flashDriveName Then
            flashDriveLetter = d.DriveLetter
        End If
    End If
Next

Then it would just be a case of updating all the formulas that reference the drive letter to the correct letter using cell.formula

Using Regular Expressions would be the most easy way to do that. You would probably want to move all the formulas with external references (E.g. the onces that would need updating to one sheet and then reference the values in that sheet in the rest of the workbook that was the cells you need to update are all in one range, making it easy to update them all using a For loop.

Anyhow if you need help with that bit feel free to ask, if you fancy going this route of keeping the drive letter up to date.
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,473
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top