Using Shared Files on a Shared Network with Different Drive Names

carl_olson

New Member
Joined
Mar 31, 2017
Messages
3
Hello,

I am building a calibrated equipment tracker and it is a centralized file on a shared drive for out workplace. However there are 3-4 different drive names for the same folder and file path. But when i try to load an image from the centralized folder on someone elses computer it doesnt work because my drive name is Z: while others are I: or J: ect..

Is there anyway to load a file from a folder path using a wildcard for the drive? See below for the areas i am looking to load and image:

Private Sub cmd_browse_Click()
Dim pict As String
Dim ImgFileFormat As String

ChDir ("Z:\Staff\Equipment Locator\Equipment Images")


ImgFileFormat = "Image Files (*.bmp;*.gif;*.tif;*.jpg),*bmp;*gif;*.tif;*.jpg"
TB_PhotoFile.Text = Application.GetOpenFilename(imagefileformat)

On Error Resume Next
Img_Equip.Picture = LoadPicture(TB_PhotoFile.Text)
'Check for filename does not exist error
If Err.Number = 53 Then
Img_Equip.Picture = LoadPicture(noimage)
End If
'Resume error checking
On Error GoTo 0




End Sub

Private Sub Search_Display()
' Search for equipment number and display results
flag = False
irow = 1
noimage = "Z:\Staff\Equipment Locator\Equipment Images\NoImageAvailable.JPG"
Do While Worksheets("Equipment List With Locations").Cells(irow, 1) <> ""
If Worksheets("Equipment List With Locations").Cells(irow, 1) = ComboBox_Search.Text Then
TB_equipnum.Text = Worksheets("Equipment List With Locations").Cells(irow, 1)
TB_description.Text = Worksheets("Equipment List With Locations").Cells(irow, 2)
TB_SN.Text = Worksheets("Equipment List With Locations").Cells(irow, 3)
TB_model.Text = Worksheets("Equipment List With Locations").Cells(irow, 4)
TB_location.Text = Worksheets("Equipment List With Locations").Cells(irow, 5)
TB_Special.Text = Worksheets("Equipment List With Locations").Cells(irow, 6)
TB_PhotoFile.Text = Worksheets("Equipment List With Locations").Cells(irow, 7)
TB_InUse.Text = Worksheets("Equipment List With Locations").Cells(irow, 13)
If Worksheets("Equipment List With Locations").Cells(irow, 8) = "Yes" Then
TB_sentfrom.Text = Worksheets("Equipment List With Locations").Cells(irow, 9)
TB_InUse.Text = ""
ElseIf Worksheets("Equipment List With Locations").Cells(irow, 8) = "No" Then
TB_sentfrom.Text = ""
End If
If Worksheets("Equipment List With Locations").Cells(irow, 8) = "Yes" Then
OB_Yes.Value = True
ElseIf Worksheets("Equipment List With Locations").Cells(irow, 8) = "No" Then
OB_No.Value = True
End If


LoadImg = Worksheets("Equipment List With Locations").Cells(irow, 7)
If Worksheets("Equipment List With Locations").Cells(irow, 7) <> "" Then
Img_Equip.Picture = LoadPicture(LoadImg)
ElseIf Worksheets("Equipment List With Locations").Cells(irow, 7) = "" Then
MsgBox " Image File Does Not Exist, Please Update Image Filename", vbexclamlation
Img_Equip.Picture = LoadPicture(noimage)
End If
flag = True
End If
If flag = True Then Exit Do
irow = irow + 1
Loop
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
You can replace the name of mapped drive with its UNC path, which is same for everyone.

To find out the UNC path, run NET USE command on command prompt. It should return names of all mapped drives and their UNC paths. Once you have that, just use find-replace in your code and lookup data to replace all occurences of Z: with its UNC path.
 
Upvote 0
Thanks!!! That worked perfectly!!!


You can replace the name of mapped drive with its UNC path, which is same for everyone.

To find out the UNC path, run NET USE command on command prompt. It should return names of all mapped drives and their UNC paths. Once you have that, just use find-replace in your code and lookup data to replace all occurences of Z: with its UNC path.
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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