Hello,
Here is what I have. I beleive Richard Schollar had something to do with the FileList function...
Copy this code into a standard module:
<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> ThumbPartialName()<br><br><SPAN style="color:#00007F">Dim</SPAN> c <SPAN style="color:#00007F">As</SPAN> Range, _<br> Listrng <SPAN style="color:#00007F">As</SPAN> Range, _<br> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>, _<br> myvar <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Variant</SPAN>, _<br> myJPGobj <SPAN style="color:#00007F">As</SPAN> OLEObject, _<br> fPath <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>, _<br> Ws <SPAN style="color:#00007F">As</SPAN> Worksheet, _<br> strFirstCell <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br> <br>strFirstCell = "B4" <SPAN style="color:#007F00">''' Change this to your first cell with data in column B:B</SPAN><br> <br><SPAN style="color:#00007F">Set</SPAN> Ws = Sheets("Sheet1")<br><SPAN style="color:#00007F">Set</SPAN> Listrng = Ws.Range(strFirstCell & ":B" & Range("B" & Rows.Count).End(xlUp).Row)<br>fPath = "C:\Users\standard account\Documents\"<br> <SPAN style="color:#00007F">If</SPAN> Right(fPath, 1) <> "\" <SPAN style="color:#00007F">Then</SPAN> fPath = fPath & "\"<br> <br> <SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> c <SPAN style="color:#00007F">In</SPAN> Listrng<br> <SPAN style="color:#00007F">If</SPAN> c.Value <> "" <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#007F00">'c.Select</SPAN><br> myvar = FileList(fPath, c.Value & "*.pdf")<br> <SPAN style="color:#00007F">If</SPAN> TypeName(myvar) <> "Boolean" <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">UBound</SPAN>(myvar) - <SPAN style="color:#00007F">LBound</SPAN>(myvar) > 0 <SPAN style="color:#00007F">Then</SPAN><br> MsgBox "Multiple files match the entry: " & c.Value & _<br> vbNewLine & "Located at: " & c.Address & _<br> vbNewLine & "Only the first match will appear.", vbOKOnly, "Multiply results"<br> <SPAN style="color:#00007F">For</SPAN> i = <SPAN style="color:#00007F">LBound</SPAN>(myvar) <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">LBound</SPAN>(myvar)<br> <br> <SPAN style="color:#00007F">Set</SPAN> myJPGobj = ActiveSheet.OLEObjects.Add(Filename:= _<br> myvar(1), Link:=True, _<br> DisplayAsIcon:=False)<br> <SPAN style="color:#00007F">With</SPAN> myJPGobj<br> .Top = c.Top<br> .Left = c.Offset(0, -1).Left<br> .Height = 0.51 * 72<br> .Width = 0.32 * 72<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br> <SPAN style="color:#00007F">Next</SPAN> i<br> <SPAN style="color:#00007F">Else</SPAN><br> <SPAN style="color:#007F00">'For i = LBound(myvar) To UBound(myvar)</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> myJPGobj = ActiveSheet.OLEObjects.Add(Filename:= _<br> myvar, Link:=True, _<br> DisplayAsIcon:=False)<br> <SPAN style="color:#00007F">With</SPAN> myJPGobj<br> .Top = c.Top<br> .Left = c.Offset(0, -1).Left<br> .Height = 0.51 * 72<br> .Width = 0.32 * 72<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br> <SPAN style="color:#007F00">'Next i</SPAN><br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <SPAN style="color:#00007F">Else</SPAN><br> MsgBox "For " & c.Value & ", no file was found,", vbOKOnly, "Possible Error"<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <SPAN style="color:#00007F">Next</SPAN> c<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><SPAN style="color:#00007F">Function</SPAN> FileList(fldr <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>, <SPAN style="color:#00007F">Optional</SPAN> fltr <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>) <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Variant</SPAN><br> <SPAN style="color:#00007F">Dim</SPAN> sTemp <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>, sHldr <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br> <SPAN style="color:#00007F">If</SPAN> Right$(fldr, 1) <> "\" <SPAN style="color:#00007F">Then</SPAN> fldr = fldr & "\"<br> sTemp = Dir(fldr & fltr)<br> <SPAN style="color:#00007F">If</SPAN> sTemp = "" <SPAN style="color:#00007F">Then</SPAN><br> FileList = <SPAN style="color:#00007F">False</SPAN><br> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Function</SPAN><br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <SPAN style="color:#00007F">Do</SPAN><br> sHldr = Dir<br> <SPAN style="color:#00007F">If</SPAN> sHldr = "" <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Do</SPAN><br> sTemp = sTemp & "|" & sHldr<br> <SPAN style="color:#00007F">Loop</SPAN><br> FileList = Split(sTemp, "|")<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN></FONT>
Be sure to change the strFirstCell to your first (top) cell with data.
You can press Alt + F8 and select ThumbPartialName to run or call by other means.
-Jeff