This code allows you to create a shortcut on the desktop, when you click a command button. Can be p
This code allows you to create a shortcut on the desktop, when you click a command button. Can be put on a timer or on load of a form. Make
API Declarations
'
' NOTE: There must be a reference to "Windows Script Host Object Model" for this macro to work & have a command1 button.
' The default ICON is assigned.
' *************************************************************
Rate This code allows you to create a shortcut on the desktop, when you click a command button. Can be p
(1(1 Vote))
Public Sub Command1_Click()
Dim objShell As IWshShell_Class
Dim objShortcut As IWshShortcut_Class
Dim FolderItem As Variant
Dim lsPath As String
Dim lsShortCut As String
Dim lsURL As String
Dim lsConfigFileName As String
Dim nType As Variant
Set objShell = New IWshShell_Class
lsShortCut = Form1.Caption ' This is what I've selected at the title of the ShortCut
lsPath = App.Path & "\" & App.EXEName & ".exe" ' Setting Microsoft Word -- or anything, really, as executable
For Each FolderItem In objShell.SpecialFolders
If Mid(FolderItem, Len(FolderItem) - 6, 7) = "Desktop" And _
InStr(1, FolderItem, "All Users") = 0 And _
InStr(1, UCase(FolderItem), "ADMINISTRATOR") = 0 Then
Set objShortcut = objShell.CreateShortcut(FolderItem & _
"\" & _
lsShortCut & _
".lnk")
objShortcut.TargetPath = lsPath
objShortcut.Arguments = lsURL & " " & _
lsConfigFileName & " " & _
CStr(nType)
objShortcut.Save
End If
Next
End Sub
This code allows you to create a shortcut on the desktop, when you click a command button. Can be p Comments
No comments yet — be the first to post one!
Post a Comment