excel - Select multiple folders - VBA -
i'm using macro merge csv files one. macro working good, have 1 block, allows select folder csv files merge.
two questions:
- can choose more 1 folder merge? (in 1 folder have lot of csv files.).
- how can choose other initial directory choose folders? need use folders server.
code block:
'browse folder csv files set oapp = createobject("shell.application") set ofolder = oapp.browseforfolder(0, "select folder csv files", 512) if not ofolder nothing foldername = ofolder.self.path if right(foldername, 1) <> "\" foldername = foldername & "\" end if
now availability choose 1 folder from:
i love choose more this:
selecting multiple folders not possible @ all. selecting two folders @ same time not work.
you can select …
- multiple files in one folder (see @funthomas answer)
- or one folder only.
here how select one folder:
public sub selectfolder() dim fdl filedialog set fdl = application.filedialog(msofiledialogfolderpicker) fdl .initialfilename = "c:\temp" 'where start choosing folder if .show <> -1 msgbox "canceled" 'nothing selected else debug.print .selecteditems(1) 'the selected folder end if end end sub
Comments
Post a Comment