Nov 02 2020 05:49 AM
I am trying to open a pdf, Acrobat Reader document, from within excel spreadsheet using hyperlink. I do have the Acrobat Reader Suite on the computer. Is it at all possible and can someone help??????
Nov 02 2020 06:22 AM
Maybe with VBA...but it depends on which version of Excel you have and which operating system.
* Knowing the Excel version and operating system would also be an advantage :).
'Class module table
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (_
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Sub Worksheet_FollowHyperlink (ByVal Target As Hyperlink)
If Right $ (LCase $ (grgRbereich.Value), 4) = ".pdf" Then
ChDrive $ Left (grgRbereich.Value, 3)
ChDir $ Left (grgRange.Value, InStrRev (grgRange.Value, "\", -1))
ShellExecute 0, "open", Dir $ (grgArea.Value), "", CurDir $ & "\", 1
End If
End Sub
Private Sub Worksheet_SelectionChange (ByVal Target As Range)
Set large area = ActiveCell
End Sub
Hope I understood the translation correctly and was able to help you.
Thank you for your understanding and patience
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here
Nov 02 2020 07:11 AM
Hi
Thank You. It is Windows 7 Pro and Office Pro 2013
Regards
Nov 02 2020 07:51 AM
Nov 05 2020 05:48 AM
Hi, Thank You i will try it!!! Just one question what does the $ in vba refers to??? My vba does not like it at all, gives a syntax error color red.
All this is red
If Right $ (LCase $ (grgRbereich.Value), 4) = ".pdf" Then
ChDrive $ Left (grgRbereich.Value, 3)
ChDir $ Left (grgRange.Value, InStrRev (grgRange.Value, "\", -1))
ShellExecute 0, "open", Dir $ (grgArea.Value), "", CurDir $ & "\", 1
All this is red
Set large area = ActiveCell
Thank You
Regards
Kobus
Nov 05 2020 07:09 AM
The dollar sign indicates a string will be returned instead of a variant.
You can find more information and examples here
https://stackoverflow.com/questions/3389444/what-does-the-symbol-do-in-vba
Hope I could help you a little bit with your plans
Nikolino
I know I don't know anything (Socrates)
Nov 05 2020 07:19 AM