par billbock » 16 Fév 2007 à 14:34
- Code : Tout sélectionner
Dim ws As New notesuiworkspace
Dim s As New notessession
a = ws.openfiledialog(False,"Select file to link to")
If Isempty(a) Then Exit Sub ' exit if user clicks Cancel
' else continue
' get filename
fname = Strrightback(a(0),"\")
Set SH = CreateObject("WScript.Shell")
' Shortcut is actually stored in Windows Temp directory, ready for attaching into document
DPath = SH.ExpandEnvironmentStrings("%windir%" & "Temp")
Set SC = SH.CreateShortcut(DPath & "Shortcut to " & fname & ".lnk")
' sets environment variable, to pass the filepath of the 'Shortcut, so it can be picked up by the formula language action button
Call s.SetEnvironmentVar("fileshortcutpath", DPath & "Shortcut to " & fname & ".lnk")
SC.TargetPath = SH.ExpandEnvironmentStrings(a(0))
SC.WorkingDirectory =SH.ExpandEnvironmentStrings("%windir%")
SC.WindowStyle = 4
SC.Save