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!
 
Here is a portion of code, its not g-code :rolleyes:, however I would like for you to get something you can work with.

-Jeff

Thanks, Jeff. I will try the code in a bit and let you know how it works.

In the mean time, I see you used to be a machinist. By any chance did you use Mastercam? If so we may have a mutual friend named gcode (Tom). Or is that a different reference?

Thanks again for the code!
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Well that was unexpected. Cool, but unexpected. :)

I thought it was going to create the thumbs in Windows Explorer, not the spreadsheet. Very cool script and it may work with a little tweaking.

The drawings I will be working with will have a mix of landscape and portrait orientations so I'll have to test for which it is and adjust size/position accordingly.

Something I've noticed is that if I use Adobe Reader and navigate to the folder I can generate thumbs for that session of that folder. It won't work for me because every time I use it it's with a different set of PDFs.

BUT, this tells me it's likely a registry setting that's creating the thumbs and if I can find out what the setting is I can incorporate it into my macro and run the reg edit every time I populate the folder with new files.

So, does anyone know what the registry string is that Adobe uses to create thumbs??? :cool:
 
Upvote 0
Hello Billy Hill,

I will not be much help on the regedit stuff.

If you choose to go with the code, maybe throw in a input box to specify fpath.

I hope someone with the adobe Reg stuff can chime in.
Keep us posted.

______________________

Machine Tool:
Job Shop.
I mostly ran a South Western Indistries Proto Trak... Conversational.
We did also have a 4th axis Fadal that ran G-code.

-Jeff
 
Upvote 0
Thanks, Jeff. The fpath will always be the same thing, c:\temp\. I delete existing files via code before copying the new files over. Because there are always new files there, creating thumbs once manually with Adobe's File Open Dialog does me no good.

Ahh, Proto Trak. I've got a Lagun Knee Mill with a set of Proto-Trak controls on it. I've also got a HF mini-mill that I'm going to convert over to CNC, eventually.
 
Upvote 0
Hi Bill
I wrote (ok rewrote) some code to be able to generate a thumbnail from a pdf file. I wrote a blog post. It will generate a thumbnail of any page of a PDF file that you want and save it as an image with specified resolution.
Unfortunately it doesn't help you because it requires .NETFramework4 and also the Ghostscrip library... you will not be allowed to install it at your work :-(

But it might be usefull if you find a way how to install the resources
 
Upvote 0
Hi PetLahev,

I did find the blog when I was looking for input about this problem. I did not try to use the code you provided for Ghostscript, However, I did breifly try to add the Adobe activeX without being able to use it successfully. I was unsure how to assign a file to the control.

At any rate, very nice work!!

Do you have an opinion if the registry setting can be modified as Billy Hill describes in a previous post?

Would you also be able to describe why this happens with adobe and vista 64 bit?


-Jeff
 
Upvote 0
I am trying to figure out how to utilize this code into something I can use. I am trying to load a pdf file to fit into a rectangle shape on my spreadsheet. I have the location of the pdf file stored in Cell A1 so I can manage to get the file to load but I am figuring out how to get it to load over top of the shape on my worksheet.
Any help?
 
Upvote 0
Hello tgrundwald,

I beleive you can take the .top and left. properties of the rectangle to place the top and left of the file as an object. Also similar with the width and height.

something like:

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> OverRectangle()<br><br>    <SPAN style="color:#00007F">With</SPAN> ActiveSheet.OLEObjects.Add(Filename:= _<br>            "C:\Users\standard account\Documents\Overwrite.pdf", Link:=True, _<br>            DisplayAsIcon:=False)<br>            <br>        .Top = ActiveSheet.Shapes("Rectangle 1").Top<br>        .Left = ActiveSheet.Shapes("rectangle 1").Left<br>        .Width = ActiveSheet.Shapes("rectangle 1").Width<br>        .Height = ActiveSheet.Shapes("rectangle 1").Height<br>    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br>        <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>


Change the file path and file name.

Does this help?

-Jeff
 
Upvote 0
Jeff,

Thanks!
Works great for aligning the top and the left side....but for some reason the width is almost double what it should be. Any ideas there?
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,254
Members
452,900
Latest member
LisaGo

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