ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loading PDFs, Shell Function (https://www.excelbanter.com/excel-programming/272913-loading-pdfs-shell-function.html)

Paul Martin

Loading PDFs, Shell Function
 
Hi guys

- I am attempting to load a pdf using the following code:

iStatus = Shell(sDirAndFilePath, vbMaximizedFocus)

- I'm using an API call that successfully returns the Acrobat installation
directory on different computers.

- On one computer, sDirAndFilePath="C:\Program Files\Adobe\Acrobat 5.0\
Acrobat\Acrobat.exe C:\test.pdf" and this works fine.

- On another computer, sDirAndFilePath="C:\Program Files\Adobe\Acrobat 4.0\
Acrobat\Acrobat.exe C:\test.pdf" but this returns an error in Acrobat "File
not found", even though no error is detected in VB.

- On the surace, it appears to be a version issue with Acrobat 4.0, but I don't
know how feasible this is. Does a PDF loaded with v4 require different
syntax to later versions of Acrobat? Any suggestions are appreciated.

Thanks in advance.

Paul Martin
Melbourne, Australia

Dave Peterson[_3_]

Loading PDFs, Shell Function
 
This might not work for you, but why not just start the .pdf file itself. Let
windows find the associated program:

Shell("start C:\test.pdf")

My expertise with API consists of copying and pasting. But did you look at
FindExecutable in your API books?


Paul Martin wrote:

Hi guys

- I am attempting to load a pdf using the following code:

iStatus = Shell(sDirAndFilePath, vbMaximizedFocus)

- I'm using an API call that successfully returns the Acrobat installation
directory on different computers.

- On one computer, sDirAndFilePath="C:\Program Files\Adobe\Acrobat 5.0\
Acrobat\Acrobat.exe C:\test.pdf" and this works fine.

- On another computer, sDirAndFilePath="C:\Program Files\Adobe\Acrobat 4.0\
Acrobat\Acrobat.exe C:\test.pdf" but this returns an error in Acrobat "File
not found", even though no error is detected in VB.

- On the surace, it appears to be a version issue with Acrobat 4.0, but I don't
know how feasible this is. Does a PDF loaded with v4 require different
syntax to later versions of Acrobat? Any suggestions are appreciated.

Thanks in advance.

Paul Martin
Melbourne, Australia


--

Dave Peterson


Paul Martin

Loading PDFs, Shell Function
 
Thanks Dave but your suggestion returns error 54: can't find file.

It appears to be neither an OS nor Acrobat version issue. I have two
computers, both Win98, both with Acrobat v4. One works, one doesn't. I
think maybe I need to reinstal Acrobat on the one that doesn't work.

If anyone has any other illuminations, that'd be great.

Regards

Paul Martin
Melbourne, Australia

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Dave Peterson[_3_]

Loading PDFs, Shell Function
 
Is the c:\test.pdf missing or the adobe executable?

When you run the same command from a DOS prompt, what do you get?
start C:\test.pdf


Paul Martin wrote:

Thanks Dave but your suggestion returns error 54: can't find file.

It appears to be neither an OS nor Acrobat version issue. I have two
computers, both Win98, both with Acrobat v4. One works, one doesn't. I
think maybe I need to reinstal Acrobat on the one that doesn't work.

If anyone has any other illuminations, that'd be great.

Regards

Paul Martin
Melbourne, Australia

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


--

Dave Peterson


Paul Martin

Loading PDFs, Shell Function
 
Dave

Your suggestion loads a new dos box with a box title of the filename.

I have since uninstalled Acrobat v4 and reinstalled it to no effect. I
then installed Acrobat Reader v5 which fixed it. I then uninstalled
Reader v5 and installed Acrobat v5 and it still worked. I then
uninstalled Acrobat v5 and installed Acrobat v4 and the problem returned
(even though I have it working on other machines with Acrobat v4).

Regards

Paul Martin
Melbourne, Australia

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Dave Peterson[_3_]

Loading PDFs, Shell Function
 
It _kind of_ sounds like a file association (well, from a distance).


When it's broken, in windows explorer: try shiftright clicking on the .pdf file
and select OpenWith.

Browse to the version of acrobat (AcroRd32.exe???) and check to always use that
program for that file type.

It might fix something...(or might not have any affect).



Paul Martin wrote:

Dave

Your suggestion loads a new dos box with a box title of the filename.

I have since uninstalled Acrobat v4 and reinstalled it to no effect. I
then installed Acrobat Reader v5 which fixed it. I then uninstalled
Reader v5 and installed Acrobat v5 and it still worked. I then
uninstalled Acrobat v5 and installed Acrobat v4 and the problem returned
(even though I have it working on other machines with Acrobat v4).

Regards

Paul Martin
Melbourne, Australia

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


--

Dave Peterson



All times are GMT +1. The time now is 11:32 PM.

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