Bonjour,
Je suis débutante en VB, je dois reprendre, et modifier une interface, à partir de laquelle on peut ajouter un lien faisant référence à une image. J'ai réussi à créer mon bouton parcourir, à afficher le chemin d'accès dans une "text box», mais lorsque je souhaite valider mon fichier afin de le convertir en lien, une erreur se déclenche.
Quelqu'un peut-il m'aider?
voici mon code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
 
Private Sub CommandButton1_Click() 
On Error Resume Next 
With Application.GetOpenFilename 
.AllowMultiSelect = False 
.Show 
UserForm1.TextBox1.Text = .SelectedItems(1) 
End With 
'display the path in the text box 
Dim Path As String 
TextBox1.Value = Workbooks(ActiveWorkbook.Name).FullName 
End Sub 
Private Sub Send_Click() 
Dim file As String, Path As String 
file = SelectedItems 
Path = TextBox1.Value 
'Copy the file in the repertory where there is the database 
On Error GoTo err 
'If there is a problem, go to the end without add the file 
Dim SourceFile, New_path 
SourceFile = Path ' Defines the name and path source file 
New_path = ThisWorkbook.Path & "\" & file ' Defines the file name and the new path target 
'Copy the source file in the target file 
FileCopy SourceFile, New_path 
On Error GoTo 0 
'Now, if there is a problem, the system don't go to the end. 
End Select 
'Deconnection 
Cnx.Close 
'Hide the userform Link 
Link.Hide 
'Msgbox in order to tell that there is no problem 
MsgBox ("OK") 
Exit Sub 
'Error when the program want to copy the file. 
err: 
MsgBox ("The file not found.") 
End Sub
Merci à quiconque peut m'aider !! Vos conseils m'ont déjà beaucoup aidés !