can anyone help to resolve the issue below...,
The code below creates Desktop shortcut,
however the target path in the newly
created icon is missinterpreted...

...namely the /wrkgrp switch parameter is getting output as
\wrkgrp which prevents the shortcut from opening the
required file.

Thank you in advance



Private Sub Command0_Click()
Dim WSHShell As Object
Set WSHShell = CreateObject("WScript.Shell")
Dim AccessPath As String
Dim MyShortcut As Object
Dim DesktopPath As String
Dim ClientDirectory As String
Dim MdwSwitch As String
Dim workfield As String
Dim wv1 As Variant
' Read desktop path using WshSpecialFolders object
DesktopPath = WSHShell.SpecialFolders("Desktop")
AccessPath = """C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"""
ClientDirectory = """C:\My Documents\secure.mdb"""
MdwSwitch = " " & "/" & "wrkgrp " & """C:\WINDOWS\system\system.mdw"""
workfield = AccessPath & " " & ClientDirectory & MdwSwitch
' Create a shortcut object on the desktop
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\Pasapp97.lnk")
' Set shortcut object properties and save it
'MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings("%windir%\notepa d.exe")

'MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings(workfield)
MyShortcut.TargetPath = workfield
'MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings("%windir%")
MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\Office\")
MyShortcut.WindowStyle = 5
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\Office\MSACCESS.EXE, 0")
'MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("%windir%\MSACCE SS.EXE, 0")
Set MyShortcut = Nothing
Set WSHShell = Nothing
End Sub