General |
6.178 WMI - ShortCut (Crea un Collegamento sul DeskTop) |
Giorgio Rancati |
La Sub che segue mostra come creareun collegamento di un file sul DeskTop con la tecnica WSH. Il codice VBA di questa sub è stato suggerito da Giorgio Rancati nel NG it.comp.appl.access l' 11 marzo 2005 ore 14:52 in un messaggio che ha per subject Link sul desktop . Per maggiori dettagli leggere quanto è scritto nel link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsprospecialfolders.asp Sub CreaLink() Dim WshShell, strDesktop, oShellLink, oUrlLink Set WshShell = CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") Set oShellLink = WshShell.CreateShortcut(strDesktop & "\Collegamento a Notepad.lnk") oShellLink.TargetPath = "Notepad.exe" oShellLink.WindowStyle = 1 oShellLink.Hotkey = "Ctrl+Alt+e" oShellLink.IconLocation = "notepad.exe, 0" oShellLink.Description = "Prova Collegamento a Notepad" oShellLink.WorkingDirectory = strDesktop oShellLink.Save Set WshShell = Nothing Set strDesktop = Nothing Set oShellLink = Nothing End Sub |