Opening a other type of document

%3CLINGO-SUB%20id%3D%22lingo-sub-1844384%22%20slang%3D%22en-US%22%3EOpening%20a%20other%20type%20of%20document%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1844384%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20open%20a%20pdf%2C%20Acrobat%20Reader%20document%2C%20from%20within%20excel%20spreadsheet%20using%20hyperlink.%20I%20do%20have%20the%20Acrobat%20Reader%20Suite%20on%20the%20computer.%20Is%20it%20at%20all%20possible%20and%20can%20someone%20help%3F%3F%3F%3F%3F%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1844384%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1844520%22%20slang%3D%22de-DE%22%3ESubject%3A%20Opening%20a%20different%20type%20of%20document%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1844520%22%20slang%3D%22de-DE%22%3E%3COL%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F826237%22%20target%3D%22_blank%22%3E%40kobus1305%3C%2FA%3E%26nbsp%3B%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMaybe%20with%20VBA...%20but%20%3CSPAN%20class%3D%22tlid-translation%20translation%22%3E%3CSPAN%20class%3D%22%22%3Eit%20depends%20on%20which%20version%20of%20Excel%20you%20have%20and%20which%20operating%20system%3C%2FSPAN%3E%3C%2FSPAN%3E.%3C%2FP%3E%3CP%3E*%20Knowing%20the%20Excel%20version%20and%20operating%20system%20would%20therefore%20be%20an%20advantage%20%3A).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E'Class%20module%20table%0A%0AOption%20Explicit%0APrivate%20Declare%20Function%20ShellExecute%20Lib%20%22shell32.dll%22%20Alias%20%22ShellExecuteA%22%20(_%0A%20%20%20%20%20%20ByVal%20hwnd%20As%20Long%2C%20_%0A%20%20%20%20%20%20ByVal%20lpOperation%20As%20String%2C%20_%0A%20%20%20%20%20%20ByVal%20lpFile%20As%20String%2C%20_%0A%20%20%20%20%20%20ByVal%20lpParameters%20As%20String%2C%20_%0A%20%20%20%20%20%20ByVal%20lpDirectory%20As%20String%2C%20_%0A%20%20%20%20%20%20ByVal%20nShowCmd%20As%20Long)%20As%20Long%0APrivate%20Sub%20Worksheet_FollowHyperlink%20(ByVal%20Target%20As%20Hyperlink)%0AIf%20Right%20%24%20(LCase%20%24%20(grgRbereich.Value)%2C%204)%20%3D%20%22.pdf%22%20Then%0A%20%20%20%20%20ChDrive%20%24%20Left%20(grgRbereich.Value%2C%203)%0A%20%20%20%20%20ChDir%20%24%20Left%20(grgRange.Value%2C%20InStrRev%20(grgRange.Value%2C%20%22%5C%22%2C%20-1))%0A%20%20%20%20%20ShellExecute%200%2C%20%22open%22%2C%20Dir%20%24%20(grgArea.Value)%2C%20%22%22%2C%20CurDir%20%24%20%26amp%3B%20%22%5C%22%2C%201%0AEnd%20If%0AEnd%20Sub%0A%0APrivate%20Sub%20Worksheet_SelectionChange%20(ByVal%20Target%20As%20Range)%0ASet%20large%20area%20%3D%20ActiveCell%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22tlid-translation%20translation%22%3E%3CSPAN%20class%3D%22%22%3EHope%20I%20understood%20the%20translation%20correctly%20and%20was%20able%20to%20help%20you.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20understanding%20and%20patience%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolino%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%222%22%3E*%20Kindly%20Mark%20and%20Vote%20this%20reply%20if%20it%20helps%20please%2C%20as%20it%20will%20be%20beneficial%20to%20more%20community%20members%20reading%20here%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1844698%22%20slang%3D%22en-US%22%3EBetreff%3A%20Opening%20a%20other%20type%20of%20document%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1844698%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3EThank%20You.%20It%20is%20Windows%207%20Pro%20and%20Office%20Pro%202013%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

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??????

6 Replies
  1. @kobus1305 

 

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

 

 

Hi

Thank You. It is Windows 7 Pro and Office Pro 2013

Regards

Should actually work.
Testing is above studying

Nikolino
I know I don't know anything (Socrates)

@Nikolino 

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

@kobus1305 

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)

 

Additional info to the $ : The symbol $ is actually a holdover from the very first BASIC diaklects in which you had to declare string variables with the dollar sign. Sometimes I feel like I'm older than I think :). The $ functions do not accept null values and explicitly return results of the string type. Therefore you can confidently delete the dollar signs, in the times of the Ghz processors you don't need this function any more to run the code a bit (felt more) faster. Nikolino I know I don't know anything (Socrates)