Gruppe
Extern
Problem
Es soll ein DeskTop-Link zu einer in Zelle B1 genannten Excel-Arbeitsmappe erstellt werden. In der Entwicklungsumgebung muss ein Verweis zum Windows Scripting Host geschaltet sein.
StandardModule: Modul1
Sub MakeDesktopShortcut()
Dim wsh As New IWshShell_Class
Dim SC As IWshShortcut_Class
Dim sPath As String, sFile As String
sPath = wsh.SpecialFolders.Item("Desktop")
sFile = Range("B1").Value
Set SC = wsh.CreateShortcut(sPath & "\test.lnk")
SC.TargetPath = sFile
SC.Hotkey = "CTRL+ALT+Z"
SC.Save
Set wsh = Nothing
End Sub