Here is a portion of code, its not g-code
, however I would like for you to get something you can work with. Here is what I got:
Create a new workbook and save it.
Alt+F11 to oper the VBEditor >>
Keystrokes Alt - I - M to Insert module >>
Paste:
(Find the line to add your file path and change to suit.)
___________________________________________
<font face=Courier New><SPAN style="color:#00007F">Option</SPAN> <SPAN style="color:#00007F">Explicit</SPAN><br><SPAN style="color:#00007F">Sub</SPAN> ThumbNail()<br><br><SPAN style="color:#007F00">'''Created 7/7/2011 ___ Repairman615, MrExcel.com</SPAN><br><br><SPAN style="color:#007F00">'''Adapted from code RunCodeOnAllXLSFiles()... (2003) and _<br> CopySameSheetFrmWbs()... (2007) _<br> found at: _<br>
http://www.ozgrid.com/VBA/loop-through.htm _<br> http://www.ozgrid.com/VBA/2007-filesearch-alternative.htm</SPAN><br> <br> <br><SPAN style="color:#00007F">Dim</SPAN> myPDFobj <SPAN style="color:#00007F">As</SPAN> OLEObject, _<br> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>, _<br> n <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>, _<br> counter <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>, _<br> fPath <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>, _<br> strExtension <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br> <br><SPAN style="color:#007F00">'Application.ScreenUpdating = False</SPAN><br><SPAN style="color:#007F00">'Application.DisplayAlerts = False</SPAN><br><SPAN style="color:#007F00">'Application.EnableEvents = False</SPAN><br> <br>i = 2<br>n = 1<br>counter = 0<br><br><SPAN style="color:#007F00">'''Change the below to the file path to folder'''''''''''''''''''''''''''''''''</SPAN><br>fPath = "C:\Users\Third_Angle_Projection_with_Geometric_Tolerancing\Documents\"<br><SPAN style="color:#007F00">'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''</SPAN><br><br><SPAN style="color:#00007F">On</SPAN> <SPAN style="color:#00007F">Error</SPAN> <SPAN style="color:#00007F">Resume</SPAN> <SPAN style="color:#00007F">Next</SPAN><br> ChDir fPath<br> strExtension = Dir(fPath & "*.pdf")<br> <SPAN style="color:#00007F">Do</SPAN> <SPAN style="color:#00007F">While</SPAN> strExtension <> ""<br> <SPAN style="color:#00007F">Set</SPAN> myPDFobj = ActiveSheet.OLEObjects.Add(Filename:= _<br> strExtension, Link:=True, _<br> DisplayAsIcon:=False)<br> <SPAN style="color:#00007F">With</SPAN> myPDFobj<br> .ShapeRange.ScaleWidth 0.42, msoFalse, msoScaleFromTopLeft<br> .ShapeRange.ScaleHeight 0.42, msoFalse, msoScaleFromTopLeft<br> .Top = Cells(i, n).Top <SPAN style="color:#007F00">'(2,2)</SPAN><br> .Left = Cells(i, n).Left<br> .Height = Range("A2:A18").Height <SPAN style="color:#007F00">'''Adj height here</SPAN><br> .TopLeftCell.Offset(-1, 0) = strExtension<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br> <SPAN style="color:#007F00">'''Adj spacing below</SPAN><br> <SPAN style="color:#00007F">Select</SPAN> <SPAN style="color:#00007F">Case</SPAN> n<br> <SPAN style="color:#00007F">Case</SPAN> 16<br> n = 1<br> i = i + 20<br> <SPAN style="color:#00007F">Case</SPAN> <SPAN style="color:#00007F">Else</SPAN><br> n = n + 5<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Select</SPAN><br> strExtension = Dir<br> counter = counter + 1<br> <SPAN style="color:#00007F">Loop</SPAN><br> <SPAN style="color:#00007F">On</SPAN> <SPAN style="color:#00007F">Error</SPAN> <SPAN style="color:#00007F">GoTo</SPAN> 0<br> MsgBox "Double Click or Right Click" & vbNewLine & "to open File" & _<br> vbNewLine & "Approx: " & counter & " Files.", vbOKOnly, "Complete"<br><SPAN style="color:#007F00">'Application.ScreenUpdating = True</SPAN><br><SPAN style="color:#007F00">'Application.DisplayAlerts = True</SPAN><br><SPAN style="color:#007F00">'Application.EnableEvents = True</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
___________________________________________
Close the editor >>
Alt + F8 to bring up the macro dialog box >>
Run Thumbnail ()
-Jeff