Sabtu, 19 Maret 2016

Re: [ExcelVBA] Creating Shortcut to a Folder on the Desktop


Dear Gary

Try this :-
Sub CreateShortCut(sFullFileOrFolderPathWithExtension As String, sShortcutTitle As String)
Dim sPathDeskTop As String
    With CreateObject("WScript.Shell")
        sPathDeskTop = .SpecialFolders("Desktop") & "\"
        With .CreateShortCut(sPathDeskTop & sShortcutTitle & ".lnk")
            .TargetPath = sFullFileOrFolderPathWithExtension
        End With
    End With
End Sub

To keep it simple I did not put in error checking and I did not test it with folder names containing spaces. 


Derek Turner
England +++

From: " [ExcelVBA]" <>
Sent: Saturday, 19 March 2016, 9:36
Subject: [ExcelVBA] Creating Shortcut to a Folder on the Desktop


Can anyone help me with the code to create a shortcut on the desktop to a specific folder in My Documents.

I've used this to create the folder but i can get my head around the shortcuts to it?

sCWIPEND = Environ("userprofile") & "\Documents\Complex Work Instructions\Pending\"

Any help greatly appreciated.




Posted by: Derek Turner <>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: to enter the ezine, then search the ARCHIVES for EXCEL VBA.

Visit our ExcelVBA group home page for more info and support files:

More free tutorials and resources available at:




Tidak ada komentar:

Posting Komentar