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
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