raccourci

D

David

Guest
Bonjour le forum

Voilà, grâce aux excellentes infos que l'on trouve sur ce forum, je coince
sur ce petit truc.
En effect, en lançant la procédure, je me retrouve sur le bureau avec non
pas le nom du fichier que je voudrais mais avec :
(activeworkbook.name
mais, en cliquant sur le raccourci, le bon fichier est ouvert, la cible est la bonne
Merci de votre aide



Sub CreerRaccourci(CheminCible)

Set WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
Set oShellLink = WshShell.CreateShortcut(strDesktop &
"\(ActiveWorkbook.Name .lnk")
oShellLink.TargetPath = CheminCible
oShellLink.WindowStyle = 1
oShellLink.Save
End Sub

Sub TestRaccourci()

CreerRaccourci "C:\user\audit\" & ActiveWorkbook.Name
End Sub
 
F

FDI

Guest
Sub CreerRaccourci(CheminCible)

Set WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
Set oShellLink = WshShell.CreateShortcut(strDesktop &
"\(" & ActiveWorkbook.Name" & ".lnk")
oShellLink.TargetPath = CheminCible
oShellLink.WindowStyle = 1
oShellLink.Save
End Sub

Sub TestRaccourci()

CreerRaccourci "C:\user\audit\" & ActiveWorkbook.Name
End Sub
 
Y

yeahou

Guest
Bonjour

le problème vient de ta ligne
Set oShellLink = WshShell.CreateShortcut(strDesktop & "\(ActiveWorkbook.Name .lnk")
activeworkbook est considéré comme une chaine de caractères
pour régler, remplace par
Set oShellLink = WshShell.CreateShortcut(strDesktop & "\(" & ActiveWorkbook.Name & ".lnk")

cordialement, A+
 
Y

yeahou

Guest
quand j'ai répondu, j'avais pas actualisé et c'est aprés que j'ai vu ta réponse. En survolant, j'ai vu que tu avais compris le probléme et je ne suis pas allé plus loin. Grillé sur le fil, c'était pour moi ;-o

A+
 

Discussions similaires

Réponses
2
Affichages
748

Statistiques des forums

Discussions
312 329
Messages
2 087 334
Membres
103 519
dernier inscrit
Thomas_grc11