Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Oct 2005
    Location
    Cambridgeshire, USA
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Desktop Shortcut (2003)

    Hello Everyone,

    I have a macro that was developed with HansV help. It creates a shortcut and maps a drive J for some users. The problem is that everytime a user logs off and then back on, they have to rerun the macro to access the J drive. Is there a macro command to say to reconnect once log on? Any help would be great.

    Private Sub CommandButton1_Click()

    On Error Resume Next
    Application.DisplayAlerts = False

    CreateObject("WScript.Network").MapNetworkDrive "J:", "testgroupsnew time sheets"
    On Error GoTo 0
    Application.DisplayAlerts = True

    Dim WSH As Object
    Dim WSHShortcut As Object
    Dim strPath As String
    Set WSH = CreateObject("WScript.Shell")

    strPath = WSH.SpecialFolders("Desktop") & "" & "timesheet.lnk"
    Set WSHShortcut = WSH.CreateShortcut(strPath)
    With WSHShortcut
    .TargetPath = "J:"
    .Description = "make shortcut to notepad"
    .IconLocation = "c:windowssystemshell32.dll,5"
    .RelativePath = "j:"
    .WorkingDirectory = "c:"
    .Hotkey = "Ctrl+Alt+Q"
    .Save
    End With

    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Desktop Shortcut (2003)

    Try

    CreateObject("WScript.Network").MapNetworkDrive "J:", "testgroupsnew time sheets", True

    See MapNetworkDrive Method.

Posting Permissions

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