Opening a pdf file with Adobe Reader
Tom
Thanks for your help but it's not working. I ran the following macro to
make sure my path and file name are correct. I get "True":
Sub TestFileExists()
Dim bFileExists As Boolean
Dim rsFullPath As String
rsFullPath = "C:\LettersForms/Ops Manuals\C1 Ops Manual.pdf"
bFileExists = Len(Dir$(rsFullPath))
MsgBox bFileExists
End Sub
I am running the following and I get a "File not found" error. Your help is
greatly appreciated. Otto
Sub OttoMacroC1()
OpenExcelFilepdf ("C1")
End Sub
Sub OpenExcelFilepdf(WhichFile As String)
ThePath = "C:\LettersForms\Ops Manuals\"
TheFile = WhichFile & " Ops Manual.pdf"
Shell "Start.exe """ & ThePath & TheFile & """"
End Sub
"Tom Ogilvy" wrote in message
...
Yes, it appears you did misread it:
Sub OpenExcelFilepdf(WhichFile As String)
ThePath = "C:\LettersForms\Ops Manuals\"
TheFile = WhichFile & " Ops Manual.pdf"
Shell "Start.exe """ & ThePath & TheFile & """"
End Sub
Note the space after Start.exe and the additional quotes.
Demo'd from the immediate window:
ThePath = "C:\LettersForms\Ops Manuals\"
Whichfile = "C1"
TheFile = WhichFile & " Ops Manual.pdf"
? "Start.exe """ & ThePath & TheFile & """"
Start.exe "C:\LettersForms\Ops Manuals\C1 Ops Manual.pdf"
shows you want the argument passed to Shell looks like.
If you still have problems, you might need to put single quotes in so it
ends up being
Start.exe "'C:\LettersForms\Ops Manuals\C1 Ops Manual.pdf'"
because of the spaces in the names. However, the example I posted has
spaces in the path and it worked, so I think yours will work without
single
quotes as well.
--
Regards,
Tom Ogilvy
--
Regards,
Tom Ogilvy
--
regards,
Tom Ogilvy
"Otto Moehrbach" wrote:
Tom
I think I am misreading what you wrote. Here is what I have written
from what you said. I get an error that the file is not found.
Sub OttoMacroC1()
OpenExcelFilepdf ("C1")
End Sub
Sub OpenExcelFilepdf(WhichFile As String)
ThePath = "C:\LettersForms\Ops Manuals\"
TheFile = WhichFile & " Ops Manual.pdf"
Shell "Start.exe" & ThePath & TheFile
End Sub
There is a file named "C1 Ops Manual.pdf" in the cited path.
Thanks for your help with this. Otto
"Tom Ogilvy" wrote in message
...
Private Sub CommandButton1_Click()
Shell "Start.exe ""D:\My Documents\sm569_Jan2001\tute6.pdf"""
End Sub
--
Regards,
Tom Ogilvy
"Otto Moehrbach" wrote:
Excel XP & Win XP
I'm trying to get the code for opening a pdf file with my Adobe
Reader.
I
can easily open the file by just double-clicking the file name, but
not
by
code, so the reader is operating correctly.
What is the proper code syntax to open, say, "TheFile.pdf", in the
path
"ThePath"? Thanks for your time. Otto
|