Créer lien hypertexte dans excel ??

Résolu
ArchiveAgain Messages postés 7 Date d'inscription lundi 7 novembre 2005 Statut Membre Dernière intervention 3 mars 2006 - 2 mars 2006 à 10:27
ArchiveAgain Messages postés 7 Date d'inscription lundi 7 novembre 2005 Statut Membre Dernière intervention 3 mars 2006 - 3 mars 2006 à 14:44
Bonjour à tous.
je souhaiterais créer un lien hypertexte dans excel pour relier ma cellule "C" & i au répertoire créer précédemment "X:" & consultant & "" & chantier & "" & nom. Après avoir cherché pendant un moment et pas mal tourné en rond, ça serait cool si quelqu'un avait la solution. Ci-dessous lignes de code précédentes

Dim n As Integer
Dim i As Integer
Dim nom As String
nblot = InputBox("Combien de lots en charge ?")
n = 0
For n = 1 To nblot
nom = InputBox("Nom du lot n°" & n)
MkDir ("X:" & consultant & "" & chantier & "" & nom)
i = 2 * n + 1
ActiveSheet.Range("C" & i) = nom

Merci d'avance

4 réponses

cs_Willi Messages postés 2375 Date d'inscription jeudi 12 juillet 2001 Statut Modérateur Dernière intervention 15 décembre 2018 22
2 mars 2006 à 14:18
'Lut,
Pour créer un lien rien de plus simple. (exemple sur la cellule A1)

Cells(1, "A").Hyperlinks.Add Cells(1, "A"), X:" & consultant & "" & chantier & "" & nom, , , "Texte de la cellule"

Voila
3
cs_Willi Messages postés 2375 Date d'inscription jeudi 12 juillet 2001 Statut Modérateur Dernière intervention 15 décembre 2018 22
2 mars 2006 à 17:34

Tu y étais presque
Le premier paramètre de la méthode Add est la cellule qui doit recevoir le lien. Toi dans ton code tu pointés sur Cells(i,3). donc cela est normale que le lien ce fasse sur la feuille courante

Sheets(chantier).Cells(i, 3).Hyperlinks.Add Sheets(chantier).Cells(i, 3), "X:" & consultant & "" & chantier & "" & nom, , , nom
3
ArchiveAgain Messages postés 7 Date d'inscription lundi 7 novembre 2005 Statut Membre Dernière intervention 3 mars 2006
2 mars 2006 à 17:02
ça marche nickel par contre le lien s'inscrit sur la page d'origine du code alors que je souhaiterais qu'elle s'affiche sur la nouvelle créé pendant le code. Comment Faire ???
Je pense qu'il y a un ActiveSheet à inclure quelque part mais où ???

Private Sub CommandButton1_Click()



Dim chantier As String
Dim consultant As String
Dim nblot As Integer


chantier = InputBox("Nom du Chantier à créer ?")
If chantier = "" Then
MsgBox "Nom Incorrect"
Exit Sub
End If

ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False, DisplayAsIcon:=False, Left:=5, Top:=5, Width:=94.5, Height:=24.75).Select



consultant = InputBox("Nom du consultant ?") If consultant "Antoine" Or consultant "Kristell" Or consultant = "Jean-Philippe" Or consultant = "Daniel" Or consultant = "Thibaut" Then
Sheets.Add.Name = chantier
MkDir ("X:" & consultant & "" & chantier)
Else
MsgBox "Nom Incorrect"
Exit Sub
End If


Dim n As Integer
Dim i As Integer
Dim nom As String
nblot = InputBox("Combien de lots en charge ?")
n = 0
For n = 1 To nblot
nom = InputBox("Nom du lot n°" & n)
MkDir ("X:" & consultant & "" & chantier & "" & nom)
i = 2 * n + 1
Sheets(chantier).Cells(i, 3).Hyperlinks.Add Cells(i, 3), "X:" & consultant & "" & chantier & "" & nom, , , nom
Next n

ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False, DisplayAsIcon:=False, Left:=5, Top:=5, Width:=94.5, Height:=24.75).Select
ActiveSheet.CommandButton1.Caption = "Sommaire"



End Sub
0
ArchiveAgain Messages postés 7 Date d'inscription lundi 7 novembre 2005 Statut Membre Dernière intervention 3 mars 2006
3 mars 2006 à 14:44
Merci beaucoup ça marche Nickel !!
0
Rejoignez-nous