Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
dela_dela
Femeie
24 ani
Bucuresti
cauta Barbat
24 - 48 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Open Hyperlink to PDF on Website at a Specific Page Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
At the end of the URL to a PDF file, you should add the following:

#page=[page number]

Replace [page number] with the desired number.

For example, a link would look like this:
https://eur-lex.europa.eu/legal-content/RO/TXT/PDF/?uri=CELEX:02022R0109-20220701&qid=1667549497510&from=EN#page=5

VBA to do this - it is to be added in the worksheet's code

In the code below you have comment on the Chrome path line because I mainly use Firefox


Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)

Set MyRng = Range("C57:C200") ' C57:C200 is the location where my hyperlinks to open the PDF file are
On Error Resume Next
If Not Intersect(ActiveCell, MyRng) Is Nothing Then
    Call open_online_PDF_page
    Exit Sub
End If
Set MyRng = Nothing

End Sub

Sub open_online_PDF_page()

Dim myLink, myPath As String
Dim myPage As Long
Dim cell As Range
Set cell = ActiveCell

'myPath = """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"""
myPath = """C:\Program Files\Mozilla Firefox\firefox.exe"""
myLink = "https://eur-lex.europa.eu/legal-content/RO/TXT/PDF/?uri=CELEX:02022R0109-20220701&qid=1667549497510&from=EN#page="
myPage = cell.Offset(0, -1) ' page number is written 1 cell to the left of where the hyperlink is
myLink = myLink & myPage

Shell (myPath & "-url " & myLink)
End Sub


Source:


pus acum 1 an
   
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
If you want to add zoom to the page as well, you can try adding the zoom parameter like below, always after the page parameter:

https://unfccc.int/sites/default/files/resource/cma2021_10_add1_adv.pdf#page=5&zoom=200,400,400

More parameters here:


pus acum 1 an
   
Pagini: 1  

Mergi la