Minggu, 20 Maret 2016

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


Hi Gary....

Here's the code I use...

Sub subCreateDeskTopShortcut( _
                spFileName As String, _
                spLinkName As String _

Dim slDesktopPath As String
Dim olShortcut As Object
Dim olWSHShell As Object

Set olWSHShell = CreateObject("WScript.Shell")

slDesktopPath = olWSHShell.SpecialFolders("Desktop")
Set olShortcut = olWSHShell.CreateShortcut(slDesktopPath & "\" & spLinkName & ".lnk")
With olShortcut
  .TargetPath = olWSHShell.ExpandEnvironmentStrings(spFileName)
End With

' ***********************************************************************************
End Sub

Sent: Sat, Mar 19, 2016 11:35 am
Subject: Re: [ExcelVBA] Creating Shortcut to a Folder on the Desktop

Hi Gary

Just find the folder in windows explorer.  Right clik on it and hold.  Drag it to the desktop and release.  You will get options including "Create Shortcut here".

David Grugeon

On 19 March 2016 at 19:36, garymust@yahoo.co.uk [ExcelVBA] <ExcelVBA@yahoogroups.com> wrote:


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: Green <1z@compuserve.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax 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