davetough
asked on
view a pdf file from access form
hello, i use code below to view a word document from access form- is there a way to view a pdf file in similar way - using command button?
thank you
thank you
Private Sub Command0_Click()
Dim WordDoc As String
Dim oApp As Object
If Dir(WordDoc) = "" Then
MsgBox "Not here"
Else
'Create an instance of MS Word
Set oApp = CreateObject(Class:="Word.Application")
oApp.Visible = True
'Open the Document
oApp.Documents.Open FileName:="\\Main\CSA\Excel\documents\TRAINING.docx"
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It does on my machines as well, but I've had more than one client who could not open a PDF file in this manner. The Shell command works for all other types, but the .pdf extension (for some reason) gives troubles.
That said, I haven't had in troubles in the last few versions of Adobe Reader.
That said, I haven't had in troubles in the last few versions of Adobe Reader.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks- just a question here- the hitechcoach database code is something- thanks-
databasemx when you suggest Shell "C:\SomeFolder\YourPdfName .PDF", vbNormalFocus
and lsmconsulting pathway to both acrobat and pdf- can i place that code in command button?
everytime i see shell - i think i need to be able to write alot of code like hitechs to make it work- have never used shell- and am wondering if my ignorance of some basics - i should probaly know- making me not understand something??
thank you
databasemx when you suggest Shell "C:\SomeFolder\YourPdfName
and lsmconsulting pathway to both acrobat and pdf- can i place that code in command button?
everytime i see shell - i think i need to be able to write alot of code like hitechs to make it work- have never used shell- and am wondering if my ignorance of some basics - i should probaly know- making me not understand something??
thank you
Sure ...
Private Sub btnViewPdf()
Shell "C:\SomeFolder\YourPdfName .PDF", vbNormalFocus
End Sub
Private Sub btnViewPdf()
Shell "C:\SomeFolder\YourPdfName
End Sub
ASKER
thanks - for help and explanation
You are welcome ...
mx
mx
mx