how shell open AcroReader w/command line filename?

I

Ian Elliott

Thanks for any help.
I want to open Acrobat Reader from an Excel macro, with a filename in the
command line. I can open Reader, but the filename in the command line has got
me.
Here's what I use to open:
x = Shell("C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe",
vbNormalNoFocus)
I used DDE before to open files:
channel = DDEInitiate("acroview", "control")
For a = 1 To 4
DDEExecute channel, "[DocOpen(""" & Pathname(a + 2) & File(a + 2) & """)]"
AppActivate (x)
Application.SendKeys "^a", True
Application.SendKeys "^c", True
....etc
But I think I can open with filename in the command line.
Any ideas?
Thanks
 
R

Ron de Bruin

Hi

Try

ActiveWorkbook.FollowHyperlink "C:\Test.pdf"


Or this example that Jim Rech posted

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Sub LaunchPDF()
ShellExecute 0, "Open", "c:\File.pdf", "", "", 1
End Sub
 
G

Gary''s Student

You can by-pass the application and go right to the file:

x = Shell("cmd.exe /c C:\UserGuide.pdf", 1)
--
Gary''s Student


Ron de Bruin said:
Hi

Try

ActiveWorkbook.FollowHyperlink "C:\Test.pdf"


Or this example that Jim Rech posted

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Sub LaunchPDF()
ShellExecute 0, "Open", "c:\File.pdf", "", "", 1
End Sub




--
Regards Ron de Bruin
http://www.rondebruin.nl


Ian Elliott said:
Thanks for any help.
I want to open Acrobat Reader from an Excel macro, with a filename in the
command line. I can open Reader, but the filename in the command line has got
me.
Here's what I use to open:
x = Shell("C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe",
vbNormalNoFocus)
I used DDE before to open files:
channel = DDEInitiate("acroview", "control")
For a = 1 To 4
DDEExecute channel, "[DocOpen(""" & Pathname(a + 2) & File(a + 2) & """)]"
AppActivate (x)
Application.SendKeys "^a", True
Application.SendKeys "^c", True
...etc
But I think I can open with filename in the command line.
Any ideas?
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top