Option Explicit
'Ajoutez la référence Windows Script Host Object Model (wshom.ocx) à votre projet.
Private Sub CreateShortCutOnDeskTop()
Dim Wsh As New WshShell
Dim DesktopPath As String
Dim FileName As String
Dim Shortcut As Variant
DesktopPath = Wsh.SpecialFolders("Desktop")
FileName = DesktopPath & "\MonAppli.lnk"
If FileExist(FileName) = False Then
Set Shortcut = Wsh.CreateShortcut(FileName)
With Shortcut
.TargetPath = App.Path & "\" & App.EXEName
.Description = "Mon Programme"
.WindowStyle = 4
.Save
End With
End If
End Sub
Private Function FileExist(ByRef inFile As String) As Boolean
'Fonction provenant de EDais (edais.mvps.org)
On Error Resume Next
Let FileExist = CBool(FileLen(inFile) + 1)
End Function