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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting PDF to Stay Open

Status
Not open for further replies.

LouieGrandie

Technical User
Mar 3, 2011
136
US
I have code to open any document based on what is entered in a field.

Private Sub Command13_Click()

Dim strInput As String

On Error GoTo Error_GetMTR
strInput = Attachment
Application.FollowHyperlink strInput, , True


Exit_GetMTR:
Exit Sub

Error_GetMTR:
MsgBox Err & ": " & Err.Description

Resume Exit_GetMTR

End Sub

Works great. The problem is that if the document is a PDF it just flashes on the screen and does not stay open. If it is a Word doc or Excel file it stays open just fine. Any thoughts on how to get the PDF to stay open?

Visit Sage's Online Community
 
Application.Followhyperlink worked for me with a literal instead of strInput on the immediate Window.

What happens if you navigate to the path stored in strInput and double click the file to open it?
 
Not what I expected... I have some thoughts, with luck one of them will pan out.

Does it work differently on other machines (assuming at work)?

If the file is not on your computer, does it work if it is?

Where is it that it doesn't work... Ask IT why it wouldn't work because of some security product.
 
What about this ?
CreateObject("WScript.Shell").Run strInput

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top