Answered by:
Hyperlink from within a Word Document to a specific page within a PDF document.

Question
-
I was hoping that someone would be able to assist me. I would like to create a hyperlink (used as a citation) on my Word document that opens directly to a specified page within a PDF document (possible other word docs and so on, but less often). How do I go about performing this? Another note, all the documents would reside within a SharePoint site.Wednesday, February 11, 2015 7:39 PM
Answers
-
I was hoping that someone would be able to assist me. I would like to create a hyperlink (used as a citation) on my Word document that opens directly to a specified page within a PDF document (possible other word docs and so on, but less often). How do I go about performing this? Another note, all the documents would reside within a SharePoint site.
I am not a Word guru, but I don't think you can run a macro from a hyperlink. But you can create an active X label that runs a macro when clicked. You can use the following macro to go to a specific page in a PDF file.
Sub OpenPDFPageView(DisplayPage As Integer) 'In order to use the macro you must enable the Acrobat library from VBA editor: 'Go to Tools -> References -> Adobe Acrobat xx.0 Type Library, where xx depends 'on your Acrobat Professional version (i.e. 9.0 or 10.0) you have installed to your PC. Dim PDFApp As AcroApp Dim PDFDoc As AcroAVDoc Dim PDFPageView As AcroAvPageView Dim PDFPath As String Dim DisplayPage As Integer PDFPath = "C:\Users\doudou\documents\test1.pdf" 'Set the page you want to be displayed 'DisplayPage = 3 'Initialize Acrobat by creating App object Set PDFApp = CreateObject("AcroExch.App") 'Set AVDoc object Set PDFDoc = CreateObject("AcroExch.AVDoc") 'Open the PDF If PDFDoc.Open(PDFPath, "") = True Then PDFDoc.BringToFront 'Maximize the document Call PDFDoc.Maximize(True) Set PDFPageView = PDFDoc.GetAVPageView() 'Go to the desired page 'The first page is 0 Call PDFPageView.GoTo(DisplayPage - 1) 'Set the page view of the pdf Call PDFPageView.ZoomTo(2, 50) End If Set PDFApp = Nothing Set PDFDoc = Nothing On Error Resume Next 'Show the adobe application PDFApp.Show 'Set the focus to adobe acrobat pro AppActivate "Adobe Acrobat Pro" End Sub
- Proposed as answer by Starian chenMicrosoft contingent staff Tuesday, February 24, 2015 9:16 AM
- Marked as answer by George Hua Tuesday, February 24, 2015 9:24 AM
Wednesday, February 11, 2015 11:54 PM -
Automating PDFs via an ActiveX control in Word requires the user to have Adobe Acrobat Pro installed. There is no indication any users, let alone all users, will have that...
Cheers
Paul Edstein
[MS MVP - Word]
You are right this link provides a VBA procedure for Acrobat reader http://www.devhut.net/2013/12/04/vba-open-a-pdf-to-a-specific-page/- Proposed as answer by Starian chenMicrosoft contingent staff Tuesday, February 24, 2015 9:16 AM
- Marked as answer by George Hua Tuesday, February 24, 2015 9:24 AM
Thursday, February 12, 2015 3:14 AM
All replies
-
Word doesn't support hyperlinking to specified PDF pages.
Cheers
Paul Edstein
[MS MVP - Word]Wednesday, February 11, 2015 10:44 PM -
I was hoping that someone would be able to assist me. I would like to create a hyperlink (used as a citation) on my Word document that opens directly to a specified page within a PDF document (possible other word docs and so on, but less often). How do I go about performing this? Another note, all the documents would reside within a SharePoint site.
I am not a Word guru, but I don't think you can run a macro from a hyperlink. But you can create an active X label that runs a macro when clicked. You can use the following macro to go to a specific page in a PDF file.
Sub OpenPDFPageView(DisplayPage As Integer) 'In order to use the macro you must enable the Acrobat library from VBA editor: 'Go to Tools -> References -> Adobe Acrobat xx.0 Type Library, where xx depends 'on your Acrobat Professional version (i.e. 9.0 or 10.0) you have installed to your PC. Dim PDFApp As AcroApp Dim PDFDoc As AcroAVDoc Dim PDFPageView As AcroAvPageView Dim PDFPath As String Dim DisplayPage As Integer PDFPath = "C:\Users\doudou\documents\test1.pdf" 'Set the page you want to be displayed 'DisplayPage = 3 'Initialize Acrobat by creating App object Set PDFApp = CreateObject("AcroExch.App") 'Set AVDoc object Set PDFDoc = CreateObject("AcroExch.AVDoc") 'Open the PDF If PDFDoc.Open(PDFPath, "") = True Then PDFDoc.BringToFront 'Maximize the document Call PDFDoc.Maximize(True) Set PDFPageView = PDFDoc.GetAVPageView() 'Go to the desired page 'The first page is 0 Call PDFPageView.GoTo(DisplayPage - 1) 'Set the page view of the pdf Call PDFPageView.ZoomTo(2, 50) End If Set PDFApp = Nothing Set PDFDoc = Nothing On Error Resume Next 'Show the adobe application PDFApp.Show 'Set the focus to adobe acrobat pro AppActivate "Adobe Acrobat Pro" End Sub
- Proposed as answer by Starian chenMicrosoft contingent staff Tuesday, February 24, 2015 9:16 AM
- Marked as answer by George Hua Tuesday, February 24, 2015 9:24 AM
Wednesday, February 11, 2015 11:54 PM -
Automating PDFs via an ActiveX control in Word requires the user to have Adobe Acrobat Pro installed. There is no indication any users, let alone all users, will have that...
Cheers
Paul Edstein
[MS MVP - Word]Thursday, February 12, 2015 12:33 AM -
Automating PDFs via an ActiveX control in Word requires the user to have Adobe Acrobat Pro installed. There is no indication any users, let alone all users, will have that...
Cheers
Paul Edstein
[MS MVP - Word]
You are right this link provides a VBA procedure for Acrobat reader http://www.devhut.net/2013/12/04/vba-open-a-pdf-to-a-specific-page/- Proposed as answer by Starian chenMicrosoft contingent staff Tuesday, February 24, 2015 9:16 AM
- Marked as answer by George Hua Tuesday, February 24, 2015 9:24 AM
Thursday, February 12, 2015 3:14 AM -
Add a page parameter as &action=embedview&wdStartOn=PageNumber at last
&action=embedview&wdStartOn=30#
https://dckworldwide.sharepoint.com/sites/Training/PMTraining/_layouts/15/WopiFrame.aspx?sourcedoc={8aad614b-1584-446d-8850-dba7993aed81}&action=embedview&wdStartOn=30#
Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.
- Edited by Sudip Misra Thursday, September 29, 2016 6:23 PM
Thursday, September 29, 2016 6:17 PM -
This has helped out tremendously. I have even been able to use in in Access as well. I have a follow on question for you if you would be able to help.
I would like to be able to select something in a PDF document and Paste the selection into a new record via dialog form along with the page number of the selection and the following Document Properties from the PDF document: File, Title, and Location. Is this possible and would you be able to assist me?
Respectfully,
Ian
Thursday, December 29, 2016 7:47 PM