Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default how shell open AcroReader w/command line filename?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default how shell open AcroReader w/command line filename?

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" wrote in message ...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default how shell open AcroReader w/command line filename?

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" wrote:

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" wrote in message ...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command line to open a specific worksheet vIQleS Excel Worksheet Functions 2 December 1st 06 12:46 AM
Excel filename command line parameter to VB mark Excel Programming 2 October 12th 04 06:47 PM
Open a Template/CSV-File from the command line sidibou - ExcelForums.com Excel Programming 2 September 17th 04 05:00 PM
Open .txt, Save as .xls from command line Dave Peterson[_3_] Excel Programming 2 June 24th 04 02:53 AM
xp shell command using vba Sudhendra Excel Programming 2 February 16th 04 05:56 AM


All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"