Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have read some of the posts about how to open up a pdf file (shell command). Does anyone know how to open a pdf file and go to a specified page in the pdf file? Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Looks like you might be able to do it from a hyperlink: 'Link from an HTML page to a specific page in PDF file (Acrobat 7.x, Acrobat 3D)' (http://kb2.adobe.com/cps/317/317300.html) although Excel may not support that kind of hyperlink - if not you might need to put an IE control on an Excel userform and work through that. Alternately, 'PDF and VBA Code Help - Access World Forums' (http://www.access-programmers.co.uk/...d.php?t=100665) presents code that (reportedly works) but you will probably need to download and add to your project a reference to an OLE from Adobe (I don't know where to download it - try a Google or Bing search on Adobe OLE and see what comes up). Good luck on this :Bgr and report back here when you get it working! -- jamescox ------------------------------------------------------------------------ jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=109374 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I cannot get the hyperlink to work - i've tried:
=HYPERLINK("\\server.com\file.pdf#page=2") =HYPERLINK("\\server.com\file.pdf#nameddest=bookma rkname") =HYPERLINK("F:\server.com\file.pdf#page=2") =HYPERLINK("F:\server.com\file.pdf#nameddest=bookm arkname") (Is a bookmark the same as a named destination?) But if I type in \\server.com\file.pdf#page=2 in IE it works fine. Maybe the IE control on an excel userform would work. Could you explain a little more about that to get me in the right direction? Thanks "jamescox" wrote: Looks like you might be able to do it from a hyperlink: 'Link from an HTML page to a specific page in PDF file (Acrobat 7.x, Acrobat 3D)' (http://kb2.adobe.com/cps/317/317300.html) although Excel may not support that kind of hyperlink - if not you might need to put an IE control on an Excel userform and work through that. Alternately, 'PDF and VBA Code Help - Access World Forums' (http://www.access-programmers.co.uk/...d.php?t=100665) presents code that (reportedly works) but you will probably need to download and add to your project a reference to an OLE from Adobe (I don't know where to download it - try a Google or Bing search on Adobe OLE and see what comes up). Good luck on this :Bgr and report back here when you get it working! -- jamescox ------------------------------------------------------------------------ jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=109374 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Correction on the last post - For the last two hyperlinks, I meant to put
(without server.com): =HYPERLINK("F:\file.pdf#page=2") =HYPERLINK("F:\file.pdf#nameddest=bookmarkname") (these do not work) "Asbest" wrote: I cannot get the hyperlink to work - i've tried: =HYPERLINK("\\server.com\file.pdf#page=2") =HYPERLINK("\\server.com\file.pdf#nameddest=bookma rkname") =HYPERLINK("F:\server.com\file.pdf#page=2") =HYPERLINK("F:\server.com\file.pdf#nameddest=bookm arkname") (Is a bookmark the same as a named destination?) But if I type in \\server.com\file.pdf#page=2 in IE it works fine. Maybe the IE control on an excel userform would work. Could you explain a little more about that to get me in the right direction? Thanks "jamescox" wrote: Looks like you might be able to do it from a hyperlink: 'Link from an HTML page to a specific page in PDF file (Acrobat 7.x, Acrobat 3D)' (http://kb2.adobe.com/cps/317/317300.html) although Excel may not support that kind of hyperlink - if not you might need to put an IE control on an Excel userform and work through that. Alternately, 'PDF and VBA Code Help - Access World Forums' (http://www.access-programmers.co.uk/...d.php?t=100665) presents code that (reportedly works) but you will probably need to download and add to your project a reference to an OLE from Adobe (I don't know where to download it - try a Google or Bing search on Adobe OLE and see what comes up). Good luck on this :Bgr and report back here when you get it working! -- jamescox ------------------------------------------------------------------------ jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=109374 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Assuming you are working out of Excel, this will do it: Public Sub PDFPageViaIE(strUrl as String) Dim ie As InternetExplorer Set ie = New InternetExplorer On Error Resume Next ie.navigate strURL Do DoEvents Loop Until ie.readyState = READYSTATE_COMPLETE Set ie = Nothing End Sub where strURL is in the form of F:\server.com\file.pdf#page=2 or \\server.com\file.pdf#page=2 or even http://www.irs.gov/pub/irs-pdf/fw4.pdf#page=2 (my test file :Bgr ) Of course, this does open it in an Internet Explorer browser window - and it may be a new tab in an existing IE window if you have one already open. The .Navigate method may accept parameters that force it to use a new window - you can look for that, if you feel you need that functionality. -- jamescox ------------------------------------------------------------------------ jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=109374 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, it works great!
Is there a way to navigate to different pages without having to create a new object every time? I tried to create an object variable that I can reuse with another procedure but it does not work for the second procedure. Here is my code: Static Sub PDFPageViaIE() Dim ie As Object Set ie = CreateObject("InternetExplorer.Application") Const strURL As String = "F:\server.com\file.pdf#page=2" ie.navigate strURL ie.Visible = True End Sub Static Sub PDFPageViaIESecondPage() Const strURL2 As String = "F:\server.com\file.pdf#page=5" ie.navigate strURL2 ie.Visible = True End Sub "jamescox" wrote: Assuming you are working out of Excel, this will do it: Public Sub PDFPageViaIE(strUrl as String) Dim ie As InternetExplorer Set ie = New InternetExplorer On Error Resume Next ie.navigate strURL Do DoEvents Loop Until ie.readyState = READYSTATE_COMPLETE Set ie = Nothing End Sub where strURL is in the form of F:\server.com\file.pdf#page=2 or \\server.com\file.pdf#page=2 or even http://www.irs.gov/pub/irs-pdf/fw4.pdf#page=2 (my test file :Bgr ) Of course, this does open it in an Internet Explorer browser window - and it may be a new tab in an existing IE window if you have one already open. The .Navigate method may accept parameters that force it to use a new window - you can look for that, if you feel you need that functionality. -- jamescox ------------------------------------------------------------------------ jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=109374 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Saving Excel 2010 files as web page or single file web page | Excel Discussion (Misc queries) | |||
Copy a page from an xla file | Excel Programming | |||
how to print file address of the file on page? | Excel Worksheet Functions | |||
Get header only on first page of multi page excel file | Excel Discussion (Misc queries) | |||
Setting a password on a Single File Web Page (mht; mhtml file) | Excel Discussion (Misc queries) |