How to get the file path in a text box
Solved
r4944
Posted messages
136
Status
Member
-
r4944 Posted messages 136 Status Member -
r4944 Posted messages 136 Status Member -
Bonjour,
I am looking for a function that can help me browse Word files through a browse button and display the path of the selected file in a textbox located right next to the browse button.
I have started with the code above, but it just opens the selected file, which is not really what I'm looking for.
Thank you
Configuration: Windows 7 / Chrome 44.0.2403.130
I am looking for a function that can help me browse Word files through a browse button and display the path of the selected file in a textbox located right next to the browse button.
I have started with the code above, but it just opens the selected file, which is not really what I'm looking for.
Thank you
Dim vaFiles As Variant
Dim i As Long
vaFiles = Application.GetOpenFilename _
(FileFilter:="Word Files (*.docx),*.docx", _
Title:="Open File(s)", MultiSelect:=False)
If Not vaFiles = False Then
' Display the path in the textbox
TextBox1.Text = vaFiles
End If
Configuration: Windows 7 / Chrome 44.0.2403.130
1 answer
-
Hello,
I believe I haven't fully understood, but I did this.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Excel As New OpenFileDialog
Excel.Filter = "Excel Files .xls|*.xls"
If Excel.ShowDialog() = 1 Then
TextBox1.Text = Excel.FileName
Else
End If
End Sub
End Class
Aaron.