ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening pdf's from Excel (https://www.excelbanter.com/excel-programming/391799-opening-pdfs-excel.html)

Libby

Opening pdf's from Excel
 
Hi there.

I've got a "Menu" worksheet that has a listbox on it. The listbox contains a
list of the files in a networked folder elsewhere and is populated using
application.FileSearch.
These are all Word documents and the user can open them my double clicking
in the item in the listbox.

I use
Set wdApp = CreateObject("Word.Application") etc to open Word and then open
the file. This works well for all users who use a mix of XP and Windows 2000.

The problem is that the Word documents in the aforementioned folder are
likely to be converted to pdf's. I've tested the listbox by populating it
from a folder with pdf files and using Tom Ogilvy's code to open it.

Sub Tester2a()
Shell "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" & _
" c:\toc1\amcr37-4.pdf", 1
End Sub


This works for the windows 2000 users with Adobe Reader 7, but not for XP
users with Adobe Reader 8.
Adobe Reader 8 opens but displays a message box "File Not Found".

Is there any way to allow for different versions and paths of Adobe Reader,
perhaps using CreateObject as with Word?

Many thanks in advance.
L


Jim Rech

Opening pdf's from Excel
 
I just ran this and it was fine:

Shell "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" & "
c:\LitchfieldTour.pdf", 1

Make sure the PDF file actually exists where specified.

--
Jim
"Libby" wrote in message
...
| Hi there.
|
| I've got a "Menu" worksheet that has a listbox on it. The listbox contains
a
| list of the files in a networked folder elsewhere and is populated using
| application.FileSearch.
| These are all Word documents and the user can open them my double clicking
| in the item in the listbox.
|
| I use
| Set wdApp = CreateObject("Word.Application") etc to open Word and then
open
| the file. This works well for all users who use a mix of XP and Windows
2000.
|
| The problem is that the Word documents in the aforementioned folder are
| likely to be converted to pdf's. I've tested the listbox by populating it
| from a folder with pdf files and using Tom Ogilvy's code to open it.
|
| Sub Tester2a()
| Shell "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" & _
| " c:\toc1\amcr37-4.pdf", 1
| End Sub
|
|
| This works for the windows 2000 users with Adobe Reader 7, but not for XP
| users with Adobe Reader 8.
| Adobe Reader 8 opens but displays a message box "File Not Found".
|
| Is there any way to allow for different versions and paths of Adobe
Reader,
| perhaps using CreateObject as with Word?
|
| Many thanks in advance.
| L
|




All times are GMT +1. The time now is 11:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com