I am trying to hyperlink PDF Floor Plans through Facility Number in VB Script Field Calculator.
My issue is that there are about 859 Floor Plans and each has a different name but starts with a Facility Number. I have no issue matching the Facility Number but what do I do about the varying string description that vary in length and contain numbers.
Facility Number = A123
Floor Plan = A123_Admin_Hall_2016.pdf
This is what I have so far, how do I incorporate the string?? Are there wild card characters I can use?
"S:\DPW\Eng Record Management\Floor Plans" & [facilityNumber] & .pdf"
I am assuming that you are searching a directory for the Plan files......
Here is an Idea to get you started...this if not very efficient but I do not have a lot to go on but guesses:
Imports System Imports System.IO Function GetFileInfo(FacilityNumber as string) as string Dim GFI as string GFI = "" ' Make a reference to a directory. Dim di As New DirectoryInfo("S:\DPW\Eng Record Management\Floor Plans\") ' Get a reference to each file in that directory. Dim fiArr As FileInfo() = di.GetFiles() ' Display the names of the files. Dim fri As FileInfo For Each fri In fiArr if left(fri.Name,3) = FacilityNumber then GFI = fri.name exit for end if Next fri if GFI = "" then GetFileInfo = "No Plans Found" else GetFileInfo = GFI End Function