Consulting

Results 1 to 3 of 3

Thread: Shortcut

  1. #1

    Shortcut

    Does anyone have some code that will automatically create a shortcut to the sheet they open.

    The shortcut will be placed on the desktop and will only be created the first time they open the sheet.

    TIA

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [VBA]

    '----------------------------------------------------------------
    Sub CreateShortCut()
    '----------------------------------------------------------------
    Dim oWSH As Object
    Dim oShortcut As Object
    Dim sPathDeskTop As String

    Set oWSH = CreateObject("WScript.Shell")
    sPathDeskTop = oWSH.SpecialFolders("Desktop")

    Set oShortcut = oWSH.CreateShortCut(sPathDeskTop & "\" & _
    ActiveWorkbook.Name & ".lnk")
    With oShortcut
    .TargetPath = ActiveWorkbook.FullName
    .Save
    End With
    Set oWSH = Nothing

    End Sub
    [/VBA]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Brilliant

    Works a treat.

    thank you for your time

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •