AW: Was genau hast Du vor?
20.08.2014 15:42:03
Mullit
Hallo,
da mußt Du dich ein bißchen durch die Objekte hangeln:
Wenn Du nur eine Verknüpfung in dem Ordner hast, dann so:
Option Explicit
Public Sub prcOpenLink()
Dim objShell As Object
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim strPath As String
strPath = "C:\Users\Peter\_1-Peter\TMP"
Set objShell = CreateObject("Shell.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strPath)
For Each objFile In objFolder.Files
With objFile
If objFSO.GetExtensionName(.Path) = "lnk" Then
objShell.ShellExecute .Name, "", strPath, "open", 1
Set objFile = Nothing
Exit For
End If
End With
Next
Set objFSO = Nothing
Set objFolder = Nothing
Set objShell = Nothing
End Sub
VBA/HTML - CodeConverter für Office-Foren
AddIn für Excel/Word 2000-2010 - komplett in VBA geschrieben von Lukas Mosimann
Projektbetreuung durch mumpel
Code erstellt und getestet in Office 12
sonst über den Namen:
'...
For Each objFile In objFolder.Files
With objFile
If .Name = "Coop.lnk" Then
objShell.ShellExecute .Name, "", strPath, "open", 1
Set objFile = Nothing
Exit For
End If
End With
Next
'...
Gruß,