Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PDF Opening 1

Status
Not open for further replies.

onefootout

Technical User
Oct 23, 2007
42
US
Hey all,

I'm having trouble opening PDFs using followhyperlink. Does it not work for PDFs?

FollowHyperlink Me!pickname.Column(2)

This worked for word docs, not when the documents were changed to pdfs of the exact same name. There aren't any spaces in there or anything.

Acrobat reader will open and immediately close. If the reader is open, it will focus the app, but won't open the document. I can open pdfs manually.

Should I be using shell? I'm not really clear on how that works. Something like this somewhere?

Shell("C:\Program Files\Microsoft\Word.EXE" strDocName)

Thanks for the help.

 
Can you double click a PDF from Windows Explorer to open it in your Adobe Reader?

John
 
See faq705-2299

Syntax is something like:

'5 is SW_SHOW, to show the window
ShellExecute(0&,"open","c:\foo\foo.pdf",vbNullString,"",5)

Thanks to dds82 for this FAQ.

John
 
Ok, so I take it to mean that followhyperlink can't be used to open pdfs?
 
Hyperlinks should work. Are they wrapped in pound signs #.
 
No pound signs. Should I have them somewhere?

I have a table with the address as a string, and when the user picks a doc name, it uses the string to open the document. Like so:

FollowHyperlink Me!pickname.Column(2)

Where would the pound signs go?
 
Unfortunately, I don't have the database where I did this handy, but I recall that the filename needs to be enclosed in pound signs something like #myreport.pdf# (may need quotes too)

If it can wait until tomorrow, I will try to locate a db that has it and post the code.
 
So in the table where I save the path string, I should put # surrounding the actual pdf name? Like:

C:\Payroll Programs\Help\#SkillComp.pdf#

Ok, I'm going to try this pound thing with the various ways I've used followhyperlink before...

Thanks for the suggestion, and I'd love to know how you got it to work using the #, if I don't figure it out.

Thanks!
 
onefootout, I wasn't able to find the file and code I was looking for. The closest I came was code to insert a record into a table as a hyperlink:

Code:
DoCmd.RunSQL "INSERT INTO FilePath ( CPID, Location ) " & _
                 "SELECT '" & stID & "', '#" & stPathLocation & "CP " & Me.txtcp_no & stRevNo & ".pdf#' ;"

in your example it would be

#C:\Payroll Programs\Help\SkillComp.pdf#

 
FollowHyperlink doesn't need the hash symbols around them.

eg

Application.FollowHyperlink "C:\Foo\Foo.pdf"

will open the file using whatever application the pdf extension is associated with.

John
 
What about this ?
CreateObject("WScript.Shell").Run Chr(34) & Me!pickname.Column(2) & Chr(34)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV,

Interesting response. For us of the novice world can you please explain what each part of your CreateObject does? I could probably put this in some code but I would not have a clue what each part is doing.

Short explaination please,

Thanks,

Puforee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top