erstmal tolles Forum!
Ich habe da ein Problem, vielleicht könnt Ihr mir auch weiterhelfen.
Ich möchte, wenn ich auf eine bestimmte Zelle klicke (z.B. C18), ein PDF-Dokument öffnen. Da dies mit einem einfachen Hyperlink in der Excel 2003 Version leider nicht mehr geht, habe ich schon nach einem Makro gesucht, dass mir die PDF Datei problemlos öffnet, siehe unten. Nun möchte ich aber auch die Funktionalität wie bei einem Hyperlink, dass wenn ich mit der linken Maustaste auf die Zelle C18 klicke sich das Makro startet. Wie kann ich das realisieren?
Vielen Dank für Eure Antworten schonmal im Voraus.
LG
Daniel
--------------
Angehängtes Makro zum Pdf-Öffnen
Option Explicit
Private Declare
Function GetShortPathName Lib "kernel32.dll" Alias "GetShortPathNameA" ( _
ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, _
ByVal cchBuffer As Long) As Long
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 Declare
Function GetActiveWindow Lib "user32.dll" () As Long
Private Const MAX_PATH = 260&
Private Const SW_MAXIMIZE = 3&
Public
Sub prcOpen_PDF()
Dim strPath As String, strShortPath As String, strFile As String
strFile = "P21.pdf"
strPath = "C:\Dokumente und Einstellungen\labas\Desktop\Pläne\"
strShortPath = Space(MAX_PATH)
GetShortPathName strPath & strFile, strShortPath, MAX_PATH
strShortPath = Left$(strShortPath, InStr(1, strShortPath, vbNullChar) - 1)
ShellExecute GetActiveWindow, "open", strShortPath, vbNullString, strPath, SW_MAXIMIZE
End Sub