J
Joshua McLemore
Hello,
First, thanks for reading my question.
I am trying to allow users to browse out to find a file and then, when
selected, enter the full file path to that selected file. The code I have
right now is ALMOST right, but only gives the file name with extension.
Any help would be excellent! Thanks.
Current Code:
Private Sub Getfile_Click()
Dim retFile As String, dlg As Variant, s As String
Set dlg = Application.FileDialog(msoFileDialogFilePicker)
With dlg
.InitialFileName = CodeProject.Path
If .Show = -1 Then s = .SelectedItems(1)
End With
If s <> "" Then
retFile = Right(s, Len(s) - InStrRev(s, "\"))
CurrentRoundupFile.Value = retFile
End If
End Sub
First, thanks for reading my question.
I am trying to allow users to browse out to find a file and then, when
selected, enter the full file path to that selected file. The code I have
right now is ALMOST right, but only gives the file name with extension.
Any help would be excellent! Thanks.
Current Code:
Private Sub Getfile_Click()
Dim retFile As String, dlg As Variant, s As String
Set dlg = Application.FileDialog(msoFileDialogFilePicker)
With dlg
.InitialFileName = CodeProject.Path
If .Show = -1 Then s = .SelectedItems(1)
End With
If s <> "" Then
retFile = Right(s, Len(s) - InStrRev(s, "\"))
CurrentRoundupFile.Value = retFile
End If
End Sub