den exakten Programmpfad (z.B. c:\programme\arobat\Adobe 5.0\Acrobat\acrobat.exe) auslesen.
bist Du sicher, dass es sich hier um eine Frage zu Excel handelt? Wenn ja solltest Du das Problem etwas anschaulicher formulieren.
Gruß
Peter
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
On Error Resume Next
Dim inhalt As Worksheet
Dim appl As String
Dim endung As String
Dim pfad As String
Dim prog As String
Dim rs
Set inhalt = Worksheets("Gesamtübersicht")
Cancel = True
appl = Trim(ActiveCell.Value)
endung = Right(appl, 3)
If ActiveCell.Column = 6 Then
If inhalt.Cells(1, 3) = 1 Then
pfad = "f:\vorlagen.97\zkb-fs\"
ElseIf inhalt.Cells(1, 3) = 2 Then
pfad = "c:\vorlagen.97\zkb-fs\"
ElseIf inhalt.Cells(1, 3) = 3 Then
pfad = "r:\vorlagen.97\zkb-fs\"
End If
If endung = "dot" Then
Set WoObj = CreateObject("Word.Application")
WoObj.Visible = True
WoObj.Documents.Add Template:=pfad & appl, NewTemplate:=False
ElseIf endung = "doc" Then
Set WoObj = CreateObject("Word.Application")
WoObj.Visible = True
WoObj.Documents.Open pfad & appl
ElseIf endung = "xls" Then
Set ExObj = CreateObject("Excel.Application")
ExObj.Visible = True
ExObj.Workbooks.Open (pfad & appl)
ElseIf endung = "xlt" Then
Set ExObj = CreateObject("Excel.Application")
ExObj.Visible = True
ExObj.Workbooks.Open (pfad & appl)
ElseIf endung = "ppt" Then
Set ppObj = CreateObject("PowerPoint.Application")
ppObj.Visible = True
ppObj.Presentations.Open (pfad & appl)
ElseIf endung = "pdf" Then
With Application.FileSearch
.LookIn = "C:\Programme"
.SearchSubFolders = True
.Filename = "acro*.exe"
If .Execute() > 0 Then
rs = Shell(.FoundFiles(1) & " " & pfad & appl, 1)
Else
MsgBox (.Filename & " konnte nicht gefunden werden!")
End If
End With
ElseIf endung = "pdb" Then
With Application.FileSearch
.LookIn = "C:\Prog"
.SearchSubFolders = True
.Filename = "project.exe"
If .Execute() > 0 Then
rs = Shell(.FoundFiles(1) & " " & pfad & appl, 1)
Else
MsgBox (.Filename & " konnte nicht gefunden werden!")
End If
End With
ElseIf endung = "jpg" Then
With Application.FileSearch
.LookIn = "C:\Programme"
.SearchSubFolders = True
.Filename = "psp.exe"
If .Execute() > 0 Then
rs = Shell(.FoundFiles(1) & " " & pfad & appl, 1)
Else
MsgBox (.Filename & " konnte nicht gefunden werden!")
End If
End With
Else
MsgBox ("Kann die Datei " & appl & " nicht aufrufen!")
End If
End If
End Sub
Gruß HW
Gruß HW