These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Button "Copy text to clipboard"

Andree
Registered: Jan 29 2008
Posts: 10

I want to distribute several PDFs that contain normal written text and within that, there are several VBA-Listings. To make it easy for the reader, I want to add a button "Copy Listing to clipboard", so that you can simply paste the listing into the VBA IDE.

How can I do that?

I guess one way is to deposit each listing (there a lots...) behind separate buttons. A listing is just a text file like:

Private Sub btnBerEinfg_Click()
On Error Resume Next
Set ctl = Screen.PreviousControl
End Sub

Another way might be to embed each listing as a TXT/RTF-File and copy that content via button to the clipboard. Sounds a bit more complex.

Any idea? Thanks!

My Product Information:
Acrobat Pro 8.1.2, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Acrobat Menu items can be run from JavaScript. Like this:

app.execMenuItem("Copy");

But, scripts in a document are restricted to menu items that are on the "White List". I'm not sure if "Copy" is on the white list by default, but it's worth a try.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script