button - VBA get list of files from file browse window -
i have following code not able list of files (when selecting multiple files) browse window, have started playing around vb please excuse obvious mistakes.
private sub cmdbrowse_click() dim success boolean success = browsefiles(me.txtfile) end sub public function browsefiles(tbx textbox) boolean dim filedlg office.filedialog dim thefile variant ' clear textbox contents. tbx.value = "" ' instantiate file dialog. set filedlg = application.filedialog(msofiledialogfilepicker) filedlg ' set title of dialog box. ' .title = "please select 1 or more files" ' clear filters , add ones want.' .filters.clear '.filters.add "access databases", "*.accdb" '.filters.add "access projects", "*.adp" '.filters.add "text files", "*.txt" '.filters.add "csv files", "*.csv" '.filters.add "excel xlsx files", "*.xlsx" '.filters.add "excel files", "*.xls" '.filters.add "all files", "*.*" .filters.add "jpeg files", "*.jpeg" .filters.add "png files", "*.png" .filters.add "all files", "*.*" ' show dialog box. if .show method ' returns true, user picked @ least ' 1 file. if .show method returns ' false, user clicked cancel. if .show = true 'get selected file each thefile in .selecteditems tbx.value = thefile next end if end browsefiles = true end function
Comments
Post a Comment