VBA Code to Create PDF Thumbnails?

Billy Hill

Board Regular
Joined
Dec 21, 2010
Messages
73
My work laptop has been replaced with a machine with Windows Vista. One of my macros grabs a bunch of links to PDF files from our server and copies them to a folder and opens the folder with big thumbnails. The thumbnails on Vista don't get created like they used to and I've heard Adobe has not desire to do anything about it. The entire reason I created the macro is so I could quickly scan through the thumbnails in Windows Explorer and perhaps put them in an email or open them or whatever. Is there any way I can generate thumbnails each time I populate the folder? Thanks!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hello,

I may be misunderstanding, however in vista when looking at files in folders like 'going to computer>> finding folder>> etc.' there is veiws near the top left between organize and system properties.

Choose Veiws>>
Extra Large

Does that do it or am I way off?

-Jeff
 
Upvote 0
Hello,

I may be misunderstanding, however in vista when looking at files in folders like 'going to computer>> finding folder>> etc.' there is veiws near the top left between organize and system properties.

Choose Veiws>>
Extra Large

Does that do it or am I way off?

-Jeff
Hi Jeff,

It does not work for PDF files in Windows Vista and I believe it is an Adobe issue, that's why I'm trying to find a work-around.

It works as expected for JPG's and other file types.
 
Upvote 0
Here's a screen shot...

Clipboard.jpg
 
Upvote 0
I see what you see, however I see thumbnails.

Try this:

Tools>>
Folder Options>>
Veiws tab>>
uncheck "Always show Icons, Never Thumbnails">>
OK.

I hope you are using Excel to generate those PDF's... :rofl:

Did that get it?

-Jeff
 
Upvote 0
I see what you see, however I see thumbnails.

Try this:

Tools>>
Folder Options>>
Veiws tab>>
uncheck "Always show Icons, Never Thumbnails">>
OK.

I hope you are using Excel to generate those PDF's... :rofl:

Did that get it?

-Jeff

It's already set to show thumbnails. (I switched it back and forth and played around a bit but it still only shows icons.)

And no, I didn't create these PDFs via Excel, but I do know how. ;)

These are drawings of machined parts that were created with Solidworks and converted from SLDDRW to PDF from there.

Also, a little more info on the thumbnail issue: It's an Adobe Reader X, Windows Vista 64bit issue and so far isn't affected by other OS'/versions.

Thanks for your help! :)
 
Last edited:
Upvote 0
I have turned up some result searching google 'adobe reader x thumbnail'

Your not alone. reader x and 64 bit seems to equal no thumbnails.

Here is a link to a supposed fix. I hope it works for you.

http://www.pretentiousname.com/adobe_pdf_x64_fix/

Also I did read that within adobe the thumbnails are present. I cannot speak to the accuracy as I am 32bit /adobe reader 9.

-Jeff
 
Upvote 0
I have turned up some result searching google 'adobe reader x thumbnail'

Your not alone. reader x and 64 bit seems to equal no thumbnails.

Here is a link to a supposed fix. I hope it works for you.

http://www.pretentiousname.com/adobe_pdf_x64_fix/

Also I did read that within adobe the thumbnails are present. I cannot speak to the accuracy as I am 32bit /adobe reader 9.

-Jeff

Unfortunately work won't let me download/install anything, that's why I'm trying to find a way to do it with code.

Is there a way to create PDF thumbnails via code?
 
Upvote 0
Here is a portion of code, its not g-code :rolleyes:, 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
 
Upvote 0

Forum statistics

Threads
1,224,516
Messages
6,179,231
Members
452,898
Latest member
Capolavoro009

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top