My pdf files were usually named as (example) Meth1.pdf. They now have to have a different name:(example) Front-Wing-Left-Hand.pdf
With this change the code now bombs out when it encounters this type of filename.
I'm not sure how to change the pos declarations as there could be numerous "-" characters in each filename.
Can anyone see a solution to this?
Cheers
Code: Select all
Private Sub List2_Click()
Dim pos1 As Integer, pos2 As Integer
Dim pos1str As String, pos2str As String
Dim N As Integer
pos1 = InStrRev(List2.List(N), "-") '6
pos2 = InStrRev(List2.List(N), "\", pos1 - 1) '0
pos1str = Mid(List2.List(N), pos2 + 1, pos1 - 1) '98754
If Right(List2, 3) = "pdf" Then
Me.MousePointer = vbHourglass
End If
If Right(List2, 3) = "jpg" Then
Me.ImgPrevFTP.Picture = LoadPicture("L:\MMPDF\ConsoleFiles\" & pos1str & "\" & List2)
'Me.PrevImg.Picture = LoadPicture("L:\MMPDF\ConsoleFiles\" & pos1str & "\" & List2)
End If
Me.MousePointer = vbDefault
End Sub