Function GetFileName(TextBoxName As TextBox, strInitialDirectory As String)
Dim fd As Object
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.Title = "Make Selection"
.InitialFileName = strInitialDirectory
.Show
End With
TextBoxName.Value = fd.SelectedItems(1)
End Function
Thanks Bob, how do i run this code? or call this fuction?
I thought we call function this way...
Code:[FONT=Courier New]Sub testrytyu()[/FONT] [FONT=Courier New]Call GetFileName[/FONT] [FONT=Courier New]End Sub[/FONT]
Sub testrytyu()
Call GetFileName(Me.TextBoxNameHere, "C:\")
[/FONT]
[FONT=Courier New]Option Compare Database
Option Explicit
[/LEFT]
[/FONT][LEFT][FONT=Courier New]
[/FONT]
[FONT=Courier New]Private Sub Command8_Click()
Call GetFileName(Me.TextBoxNameHere, "C:\")
End Sub