简体   繁体   中英

PDF Snippets in Word Doc with VBA?

So I have this Word doc with a bunch of ActiveX buttons, and whenever one of the buttons is pressed, a corresponding image pops up in a userform. It looks like this:
在此输入图像描述

My problem is that each of the images that pops up is a screenshot of a portion of a PDF, but my users actually need to be able to select/copy the text presented.

Is there any good way to embed portions of a PDF file in a userform so that the text is select-able? It shouldn't be edit-able, just select-able.

Or, worst case scenario, what might be the easiest way to copy text from the PDF myself and format it onto a userform?

Thanks!

I wouldn't recommend using the image control for this if you want user to select the text from pdf.

Do this.

  1. Install Adobe Pdf Reader on your pc.
  2. Create a New Userform and place the AcroPDF1 and CommandButton control and you are done.

To Add the AcroPDF1 control see the screenshot

在此输入图像描述

Next, draw the control on the Userform and place a CommandButton on the form

This is how your userform might look.

在此输入图像描述

Put this code in the click event of the CommandButton1.

Option Explicit

Private Sub CommandButton1_Click()
    '~~> Change filename as applicable
    AcroPDF1.LoadFile "C:\Sample.Pdf"
End Sub

Now when you run it, the pdf will be displayed and you can select text. See screenshot below.

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM