Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

populate text box with file open dialog box

Status
Not open for further replies.

pburke11

Technical User
Dec 9, 2008
6
US
Hi,
I have been trying to get the right combinations to pass the user selected files from a file open dialog box to a text box in a user form. I think I have the right dialog to put each file on a separate line, but running the routine either doesn't pass the variable or only passes 1 name.

For i = LBound(fileop) To UBound(fileop) 'identifies array min-max
'displays file name(s) in a text box in user form
frm_export_files!Text_sel_file.Text = _
fileop(i) & vbCrLf

What am I missing? Any help would be appreciated.

Is there a way to just pass the file name to the text box without the path statement?
 
What about this ?
frm_export_files!Text_sel_file.Text = Join(fileop, vbCrLf)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Or - use a listbox?

frm_export_files!TheList.RowSource = Join(fileop, ";")

(Use Value List as Row Source Type)

Roy-Vidar
 
PH,
Join was definately the missing link. Works great. thank you.
The user form I'm passing the text to is nothing more than user confirmation for file selection. Once there either ok or cancel will be selected. Since I'm not looking for user entry in the form is there pro/con for text box versus listbox?
 
No, not in that context.

Addressing the second part of the initial question - getting only the filename, one suggestion could be going back to the original code, and do:

[tt]frm_export_files!Text_sel_file.Value = _
frm_export_files!Text_sel_file.Value & _
Mid$(fileop(i), InStrRev(fileop(i), "\") + 1) & vbCrLf[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top