Question : Create Windows shortcut using VBA with /WrkGrp switch

I am trying to create a windows shortcut using VBA with the following code

On Error Resume Next
    Dim wsShell As New WshShell
    Dim wsSCut As WshShortcut
    Dim strCommandLine As String 'Command Line for shortcut to run
    strCommandLine = Chr(34) & "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" & Chr(34)
    strCommandLine = strCommandLine & " /WrkGrp " & Chr(34) & "C:\Security.mdw" & Chr(34)
    strCommandLine = strCommandLine & " " & Chr(34) & "C:\MyDb.mdb" & Chr(34)
    Set wsSCut = wsShell.CreateShortcut("C:\ShortcutToMyDB.lnk")
    With wsSCut
        .TargetPath = strCommandLine
        .Save
    End With
   
    Set wsSCut = Nothing
    Set wsShell = Nothing
End Sub

The problem is that the

/WrkGrp

switch gets converted to \WrkGrp causing the resultant shortcut to fail.

Is there any way to crate a shortcut with the /WrkGrp switch in tact using VBA ?

Answer : Create Windows shortcut using VBA with /WrkGrp switch

BTW, did you see: http://www.pacificdb.com.au/MVP/Code/CreateShortcut.htm

Nic;o)
Random Solutions  
 
programming4us programming4us