Here is the code that I use to create a shortcut of Access database file in current directory and change the shortcut icon (1 Viewer)

nhtuan

New member
Local time
Today, 00:04
Joined
Dec 23, 2010
Messages
24
Code:
Private Sub Command6_Click()
   Dim ShortcutPath As String
   Dim FileSname As String
  
   FileSname = Left(CurrentProject.Name, InStr(CurrentProject.Name, ".") - 1)
   ShortcutPath = CurrentProject.Path & "\" & FileSname & " - Shortcut.lnk"
    With VBA.CreateObject("WScript.Shell").CreateShortCut(ShortcutPath)
        .TargetPath = CurrentProject.Path & "\" & CurrentProject.Name
        .WorkingDirectory = CurrentProject.Path
        .Description = "Shortcut"
        .IconLocation = CurrentProject.Path & "\" & "mydraw.ico"
        .WindowStyle = 7
        .Save
    End With
End Sub
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:04
Joined
Oct 29, 2018
Messages
21,473
Hi. Thanks for sharing.
 

Gasman

Enthusiastic Amateur
Local time
Today, 08:04
Joined
Sep 21, 2011
Messages
14,299
Wouldn't the shortcut be more useful on the desktop?
 

Users who are viewing this thread

Top Bottom