Shell function

Hi

 I have problem for opening files in the later versions of Acrobat. How can I modify this line to open the file in any versions of acrobat?

dblfile = Shell("C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe ""C:\Program Files\CheckSystem\External Data\Logical Information\Logical Time\Myfile.pdf", vbMaximizedFocus)

Thanks for your suggestion.
bincemAsked:
Who is Participating?
 
sajuksCommented:
Use the shellexecute api and let windows decide what would be the program...
//credit to  ryancys ( not sure of the actual coder, i 'd this code some time back with me )

Public 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

Public Function StartDoc(ByVal FileName As String, Optional CommandLine As String = "") As Long
    StartDoc = ShellExecute(0&, "Open", FileName, CommandLine, vbNullString, 1)
End Function

Call like:

StartDoc "C:\test.pdf"

0
 
Ryan ChongCommented:
Yes, use ShellExecute API

btw, sajuks, i think the only lines originally from me is  Public Function StartDoc ...  not big improvement just make it easier to use (yes many others may have same codes as mine) , anyway just my $0.02 ;-) cheers
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
bincemAuthor Commented:
Hi sajuks.

That is the perfect solution.

Thank you
Bince
0
 
sajuksCommented:
Thanks for the points and grade..
0
 
DhaestCommented:
So I better post only the function you need and no longer to the complete explanation of how and what shellexecute is then for getting the points !!!
0
 
sajuksCommented:
hey Dhaest, if u see the psots we've both posted at the same time...i dont mind u asking for a split from CS for it.

:-)
0
 
DhaestCommented:
To "sajuks": Now is just see it that we both posted at the same time, so just ignore my previous remark.
Thx for the info.
0
 
bincemAuthor Commented:
Hi Dhaest,

Infact both post came in the same time and I was in a hurry to resolve that issue.
sajuks posted the code along with his answer. I just tried 'sajuks' code and it did work at first time itself. Immediatly I accepted the answer. Now only I realized both of you posted the same solution. Thanks a lot for your effort.

Bince
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.