How to get a PDF preview in Excel

Tired of opening every single file just to remind yourself what is all about? If You want to learn how to create image or PDF preview in Excel, jump in and You won’t regret this.

How to get a pdf preview in Excel Barney Stinson

Recently I got requested to do the tool, which will be able to create list of photos based on the given file name and main folder path. It sounds very simple, as always… This time I’m not going to talk about whole code. I just want to describe only some important details to achieve everything in this case.

First thing, which I found interesting, fascinating and frustrating at the same time was that column .Width. This property has pixel unit, but is read only. There is also .ColumnWidth, but its unit is equal to the width of one character in the Normal style. I described this problem in my last article.


Secondly, shapes are not as friendly in resizing or moving as cells themselves. Unless, You’ll remember about .Placement property.

To create a preview or thumbnail of image just add picture from shapes.

Set myPic = Sheets(1).Shapes.AddPicture(picpath, False, True, 20, 20, -1, -1)

To sort or filter freely remember about mentioned earlier .Placement property.

myPic.Placement = xlMoveAndSize

PDF preview

Third point of this article will be connected with PDF files. There are 3 things I want to describe in case of PDFs.

1.You must have installed pdf reader on your computer.

Without having a pdf reader the Excel will not know how to show You a preview of the first file page. I can recommend Adobe Acrobat Reader, I’m fine with that app.

2. Your pdf files need to have set your pdf reader as the opening application.

You may have installed the reader, but also without that setting (Opens with:) You’ll still receive just a default logo, not the preview.

How to get a pdf preview in Excel

Knowing this, You can easily start coding.

So, having met the above points, it is time to get a PDF thumbnail. Of course not with your PDF reader application logo, but only with first page preview.

Set myPic = Sheets(1).OLEObjects.Add(Filename:=picpath, Link:=False, DisplayAsIcon:=False)

And the last thing, but only if You are using Adobe Acrobat Reader – secured files. Anyway I bet 90% of You use it, so it will be useful for sure.

3.You can’t create pdf object of secured file, unless…

Unless You turn off the “Enable Protected Mode at startup”.

Where I can turn this off?

Open Adobe, go to Edit / Preferences… and in Security (Enhanced) just uncheck the box.

Easy? No? Ok ok, I got a screenshot for You.

How to get a pdf preview in Excel secured pdf

To sum up…

Using the tips from this article You will be able to do image and PDF preview in Excel file. It’s up to You what layout You’ll choose, will it be pink or black, containing 2 or 10 columns. The hardest part is done, here by me. Now it’s your turn. Give me a sign in comment section what are your results.

Author: Tomasz Płociński

I'm very advanced in VBA, Excel, also easily linking VBA with other Office applications (e.g. PowerPoint) and external applications (e.g. SAP). I take part also in RPA processes (WebQuery, DataCache, IBM Access Client Solutions) where I can also use my SQL basic skillset. I'm trying now to widen my knowledge into TypeScript/JavaScript direction.

2 thoughts on “How to get a PDF preview in Excel”

Leave a Reply

Your email address will not be published. Required fields are marked *