Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Thanked 0 Times in 0 Posts

    shortcut on desktop through code (Acess 2000)

    I am working with a remote database and my question is can i create a code that creates a
    shortcut for the database on the desktop? It is very easy to do it if the computer is with me, but
    if i have to send it to another city, can i do it by code?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 30 Times in 30 Posts

    Re: shortcut on desktop through code (Acess 2000)

    Use code like this, for example:

    Sub CreateDesktopShortcut()
    Dim WSHShell As Object
    Dim strDesktopPath As String
    Set WSHShell = CreateObject("WScript.Shell")
    ' Read desktop path using WshSpecialFolders object
    strDesktopPath = WSHShell.SpecialFolders("Desktop")
    With WSHShell.CreateShortcut(strDesktopPath & "Shortcut to database.lnk")
    ' Set shortcut object properties and save it
    .TargetPath = CurrentDb.Name
    End With
    Set WSHShell = Nothing
    End Sub

    Replace 'Shortcut to database' with another name for the shortcut if you like, and replace CurrentDb.Name with the full path and name of another database if you don't want to create a link to the current database.

Posting Permissions

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