Gruppe
Extern
Problem
Bei Doppelklick auf A1 sollen 3 Dateien mit der in Zelle D3 genannten Suffix aus dem in Zelle D1 genannten Verzeichnis mit der in Zelle D2 genannten Anwendung geöffnet werden.
ClassModule: Tabelle1
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim sFile As String, sPath As String, sTxt As String, sExe As String, sSfx As String
If Target.Address <> "$A$1" Then Exit Sub
Cancel = True
sPath = Range("D1").Value
sExe = Range("D2").Value
sSfx = Range("D3").Value
sFile = Range("A1").Value
sFile = WorksheetFunction.Substitute(sFile, " ", "")
Do While InStr(sFile, ",")
sTxt = sPath & "\" & Left(sFile, InStr(sFile, ",") - 1) & "." & sSfx
If Dir(sTxt) <> "" Then Shell sExe & " " & sTxt, vbNormalFocus
sFile = Right(sFile, Len(sFile) - InStr(sFile, ","))
Loop
sTxt = sPath & "\" & sFile & "." & sSfx
If Dir(sTxt) <> "" Then Shell sExe & " " & sTxt, vbNormalNoFocus
End Sub