Highlighted

opening reader in excel VBA

Explorer ,
Aug 29, 2020

Copy link to clipboard

Copied

I am trying for couple years to have an excel program that I have to be able to open a PDF file and go to a specific page.

There is a way if the file is a web-based file to open it via the excel using the IE (internet explorer).

But if the file is stored in local hard drive then IE cannot handle it.

So is any way using excel VBA to open a PDF file and go to a specific page using.

1-any other browsers.

2-any way to open it using Adobe Reader.

Any help on this will be much appreciated

Kosta

I did that and is working.

And I found where was my mistake and I fix it and now works my way.

I cannot thank you enough about this.

Thank you,

Kosta

TOPICS
General troubleshooting, PDF and browsers, View PDF, Windows

Views

224

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

opening reader in excel VBA

Explorer ,
Aug 29, 2020

Copy link to clipboard

Copied

I am trying for couple years to have an excel program that I have to be able to open a PDF file and go to a specific page.

There is a way if the file is a web-based file to open it via the excel using the IE (internet explorer).

But if the file is stored in local hard drive then IE cannot handle it.

So is any way using excel VBA to open a PDF file and go to a specific page using.

1-any other browsers.

2-any way to open it using Adobe Reader.

Any help on this will be much appreciated

Kosta

I did that and is working.

And I found where was my mistake and I fix it and now works my way.

I cannot thank you enough about this.

Thank you,

Kosta

TOPICS
General troubleshooting, PDF and browsers, View PDF, Windows

Views

225

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 29, 2020 0
Most Valuable Participant ,
Aug 29, 2020

Copy link to clipboard

Copied

You can do it via the command line. https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDFOpenParameters.pdf

Very limited since, if the document is already open, it does nothing. To change the displayed page you can use OLE and JavaScript, but this needs paid-for Acrobat.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 29, 2020 0
Explorer ,
Aug 29, 2020

Copy link to clipboard

Copied

Thank you for your prompt replay,

This does not help me.

I was hoping that I can open a PDF file and the go to a specific page.

I need the command lines in VBA to do that.

Directing the VBA to open the PDF file using if need to be a acrobat reader that is stored in a specific directory and then go and open the file and go to a specify page.

I am very sure this is done before it is unthinkable that no one thought of this.

If I am in the wrong forum, please let me know witch forum I should be.

Thank you

Kosta

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 29, 2020 0
Most Valuable Participant ,
Aug 29, 2020

Copy link to clipboard

Copied

"This does not help me.

I was hoping that I can open a PDF file and the go to a specific page.

I need the command lines in VBA to do that."

You mean, like it explains on page 5??

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 29, 2020 0
Explorer ,
Aug 29, 2020

Copy link to clipboard

Copied

Sorry let me look I my overlook it.

I will let you know.

Kosta

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 29, 2020 0
Explorer ,
Aug 29, 2020

Copy link to clipboard

Copied

I did implement the code is opening the pdf but is telling that cannot find the file.

Is any possibility for you to look my code and see if I did everything correct?

Kosta

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 29, 2020 0
New Here ,
Aug 29, 2020

Copy link to clipboard

Copied

Ok tnks

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 29, 2020 0
Explorer ,
Aug 30, 2020

Copy link to clipboard

Copied

the excel file is in the Dropbox link below.

https://www.dropbox.com/s/p0m4jmwqvilhuay/test1%20PDF.xlsm?dl=0

the idea is to open the pdf file to a specify page and the page number are in column "E" I am not using the button in front page ruining the code directly from VBA this is work in progress.

As you see the code above, I am trying to open the file using IE and is tagging the page number in the end but IE omits that part of it even if you hard coded

Let me know please.

thank you

Kosta

Sub OpenPDFpage1()
    Dim myLink As String
    Dim mypage As Long
    If ActiveWindow.RangeSelection.Count > 1 Then
        MsgBox "Please select one cell in column E, then try again."
        Exit Sub
    End If
    If ActiveWindow.RangeSelection.Column <> 5 Then
        MsgBox "Please select one cell in column E, then try again."
        Exit Sub
    End If
    If Not IsNumeric(ActiveWindow.RangeSelection.Value) Then
        MsgBox "The active cell does not contain a page number."
        Exit Sub
    End If
    myLink = "D:\Dropbox\LIJSL Division Alignment\division alignment Fall 2020\" & _
        Range("B12").Value & "-" & "Registration Forms\" & Range("B12").Value & "-" & _
        Range("B9").Value & " " & Range("B10").Value & " " & Range("B11").Value & " " & _
        Range("D11").Value & ".pdf"
    mypage = ActiveWindow.RangeSelection.Value
    Shell "Acrobat.exe /A ""page=" & mypage & "=OpenActions"" """ & myLink & """", vbNormalFocus
End Sub

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2020 0
Most Valuable Participant ,
Aug 30, 2020

Copy link to clipboard

Copied

Since your problem is that your command line is invalid somehow you need to get the command line itself. I suggest you take the string you put on Shell and instead take the IDENTICAL string and copy it to the clipboard. Now you can paste it into a message to be examined. 

 

The most obvious possible problems are

1. You said you have Reader but have used the command line for Acrobat. Put the path name for Reader or Acrobat according to what the user has installed.

2. Both the executable name and the PDF file name need to be in quotes (like "c:\this\that file.pdf") if they have spaces in.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2020 0
Explorer ,
Aug 30, 2020

Copy link to clipboard

Copied

Well that is the next question.

I have Adobe suit in my computer and when I run this my Adobe Pro DC opens then tells me that the file path is wrong.

But what I would like to install an acrobat plain reader to a common directory so all the users to use.

For example, the file that I am trying to open it in a specific page is in directory D:\Dropbox\LIJSL Division Alignment\division alignment Fall 2020\Boys Registration Forms\Boys-U-14 2007 FALL 2020.pdf

S you see this a cloud-based directory (DropBox) that my group can access it.

 What if I install a Adobe plain reader in a separate directory in say D:\Dropbox\LIJSL Division Alignment\Adobe\

And then I can point the .EXE to that directory.

You think this the way to do it.

What is my concern is that in my computer I already have everything in my attempt to load a Acrobat reader to Dropbox is it going to interfere with my Adobe pro DC.

Thank you in advance.

Kosta

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2020 0
Explorer ,
Aug 30, 2020

Copy link to clipboard

Copied

I have fixe the code so points to Adobe.EXE

and i get this Screenshot 2020-08-30 08.07.15.png

Sub OpenPDFpage1()
Dim myLink As String
Dim mypage As Long
If ActiveWindow.RangeSelection.Count > 1 Then
MsgBox "Please select one cell in column E, then try again."
Exit Sub
End If
If ActiveWindow.RangeSelection.Column <> 5 Then
MsgBox "Please select one cell in column E, then try again."
Exit Sub
End If
If Not IsNumeric(ActiveWindow.RangeSelection.Value) Then
MsgBox "The active cell does not contain a page number."
Exit Sub
End If
myLink = "D:\Dropbox\LIJSL Division Alignment\division alignment Fall 2020\" & _
Range("B12").Value & "-" & "Registration Forms\" & Range("B12").Value & "-" & _
Range("B9").Value & " " & Range("B10").Value & " " & Range("B11").Value & " " & _
Range("D11").Value & ".pdf"
mypage = ActiveWindow.RangeSelection.Value
Shell "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe /A ""page=" & mypage & "=OpenActions"" """ & myLink & """", vbNormalFocus
End Sub

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2020 0
Most Valuable Participant ,
Aug 30, 2020

Copy link to clipboard

Copied

1. No, you cannot share Acrobat Reader. It must be installed. You also do not have the rights to distribute it - Adobe are very strict on this. 

2. There is a Windows API "FindExecutable" to discover which EXE would open a given file name.

3. Please do what I suggested and post the ACTUAL COMMAND LINE STRING you are passing to Shell. Right now you're asking us to run your code or guess what it does, but the string might answer the question in moments.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2020 0
Explorer ,
Aug 30, 2020

Copy link to clipboard

Copied

I do understand but Adobe reader is free for anyone to downloaded it’s allots of sites that offering to download free adobe reader.

But besides that, which string you are referring.

Remember you are talking to an amateur so please let me know.

And sorry for the delay answer I am not getting any notification even say a notification will be emailed to me.

Thank you,

Kosta

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2020 0
Most Valuable Participant ,
Aug 30, 2020

Copy link to clipboard

Copied

"understand but Adobe reader is free for anyone to downloaded it’s allots of sites that offering to download free adobe reader." These sites are illegal, and are pursued by Adobe. Adobe want to strictly control all downloads. A download license (read the license) only allows you to install it for your own personal use.

 

"But besides that, which string you are referring." The string you pass on the shell command at the end of your code. That exact, complete string. Change the code to put it on the clipboard, or write it, then screen shot. We need to know exactly what it is: DO NOT retype what you think it is. 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2020 0
Explorer ,
Aug 30, 2020

Copy link to clipboard

Copied

I did that and is working.

And I found where was my mistake and I fix it and now works my way.

I cannot thank you enough about this.

Thank you,

Kosta

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2020 0