J
Jose Perdigao
The following procedures will create a shortcut in the desktop and it works
fine.
The problem is, the icon shortcut is ms access and I would like create the
shortcut but with my own icon.
Any ideas?
Thanks,
josé perdigão
Public Sub CreateDesktopShortcut(strShortcutTitle As String, Optional
strTargetPath As String = "")
On Error Resume Next
Dim oShell As IWshShell_Class
Dim oShortcut As IWshShortcut_Class
Dim vItem As Variant
Dim vType As Variant
Set oShell = New IWshShell_Class
If strTargetPath = "" Then
strTargetPath = CurrentDb.Name
End If
For Each vItem In oShell.SpecialFolders
If Mid(vItem, Len(vItem) - 6, 7) = "Desktop" And _
InStr(1, vItem, "All Users") = 0 And _
InStr(1, UCase(vItem), "ADMINISTRATOR") = 0 Then
Set oShortcut = oShell.CreateShortcut(vItem & "\" &
strShortcutTitle & ".lnk")
oShortcut.TargetPath = strTargetPath
oShortcut.Save
End If
Next
End Sub
Private Sub cmdCreate_Click()
'For this code to execute you must add a reference to the
'Windows Script Host Object Model (WSHOM.OCX).
Call CreateDesktopShortcut("This is my shortcut title")
End Sub
fine.
The problem is, the icon shortcut is ms access and I would like create the
shortcut but with my own icon.
Any ideas?
Thanks,
josé perdigão
Public Sub CreateDesktopShortcut(strShortcutTitle As String, Optional
strTargetPath As String = "")
On Error Resume Next
Dim oShell As IWshShell_Class
Dim oShortcut As IWshShortcut_Class
Dim vItem As Variant
Dim vType As Variant
Set oShell = New IWshShell_Class
If strTargetPath = "" Then
strTargetPath = CurrentDb.Name
End If
For Each vItem In oShell.SpecialFolders
If Mid(vItem, Len(vItem) - 6, 7) = "Desktop" And _
InStr(1, vItem, "All Users") = 0 And _
InStr(1, UCase(vItem), "ADMINISTRATOR") = 0 Then
Set oShortcut = oShell.CreateShortcut(vItem & "\" &
strShortcutTitle & ".lnk")
oShortcut.TargetPath = strTargetPath
oShortcut.Save
End If
Next
End Sub
Private Sub cmdCreate_Click()
'For this code to execute you must add a reference to the
'Windows Script Host Object Model (WSHOM.OCX).
Call CreateDesktopShortcut("This is my shortcut title")
End Sub