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
            .Save
        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. 

Regards

Derek Turner
England +++


From: "garymust@yahoo.co.uk [ExcelVBA]" <ExcelVBA@yahoogroups.com>
To: ExcelVBA@yahoogroups.com
Sent: Saturday, 19 March 2016, 9:36
Subject: [ExcelVBA] Creating Shortcut to a Folder on the Desktop

 
Hi

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.

Gary 

 


__._,_.___

Posted by: Derek Turner <g4swy@yahoo.com>
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: 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:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------

.

__,_._,___

Tidak ada komentar:

Poskan Komentar