R
Ray
Hi -
I've built a dashboard that contains, among other things, links to
external files. Most of these files are excel, but a couple are
PDFs. I built some code to open the selected file, including a hard-
coded path to Acrobat Reader. The problem is that I assumed that all
users would using the same version of Acrobat Reader and apparently,
we're not ... so now need to modify the code to identify the version
number and use it in the code. Current code is as follows:
[Note: XLfile and YBook are publicly declared variables]
**********************************************
Sub OpenYBook()
Dim dbRetValue As Double
Dim stAdobeExe As String, stFileName As String
stAdobeExe = "C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe"
If Dir(XLfile & YBook) <> "" Then
dbRetValue = Shell(stAdobeExe & " " & XLfile & YBook,
vbMaximizedFocus)
Else
MsgBox "The following report isn't currently available:" & Chr(10)
& _
YBook & Chr(10) & Chr(10) & _
"Please check again later!", vbExclamation + vbOKOnly, "File
Not Available"
End If
End Sub
**********************************************
So, instead of hard-coding 'Reader 9.0', the code should identify what
version is available (currently 8.0 and 9.0) and then open that one.
I could use an if/then to open the files, but I expect we'll upgrade
at some point and then the code won't work again.
Thanks your help!
br//ray
I've built a dashboard that contains, among other things, links to
external files. Most of these files are excel, but a couple are
PDFs. I built some code to open the selected file, including a hard-
coded path to Acrobat Reader. The problem is that I assumed that all
users would using the same version of Acrobat Reader and apparently,
we're not ... so now need to modify the code to identify the version
number and use it in the code. Current code is as follows:
[Note: XLfile and YBook are publicly declared variables]
**********************************************
Sub OpenYBook()
Dim dbRetValue As Double
Dim stAdobeExe As String, stFileName As String
stAdobeExe = "C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe"
If Dir(XLfile & YBook) <> "" Then
dbRetValue = Shell(stAdobeExe & " " & XLfile & YBook,
vbMaximizedFocus)
Else
MsgBox "The following report isn't currently available:" & Chr(10)
& _
YBook & Chr(10) & Chr(10) & _
"Please check again later!", vbExclamation + vbOKOnly, "File
Not Available"
End If
End Sub
**********************************************
So, instead of hard-coding 'Reader 9.0', the code should identify what
version is available (currently 8.0 and 9.0) and then open that one.
I could use an if/then to open the files, but I expect we'll upgrade
at some point and then the code won't work again.
Thanks your help!
br//ray