Wednesday 15 May 2013

VBA EXCEL To Prompt User Response to Select Folder and Return the Path as String Variable -



VBA EXCEL To Prompt User Response to Select Folder and Return the Path as String Variable -

this question has reply here:

vba - folder picker - set start 4 answers

i trying write vba code dialog box appear user select want save files. however, need path value (e.g. c:\desktop\values) returned string variable utilize in function. help appreciated.

consider:

function getfolder() string dim fldr filedialog dim sitem string set fldr = application.filedialog(msofiledialogfolderpicker) fldr .title = "select folder" .allowmultiselect = false .initialfilename = application.defaultfilepath if .show <> -1 goto nextcode sitem = .selecteditems(1) end nextcode: getfolder = sitem set fldr = nil end function edit

this code adapted ozgrid

excel vba excel-vba

No comments:

Post a Comment