osx - Folder browser/picker breaks when ported to Mac -
i've been searching awhile answer this, vague, i'm still pretty clueless. created program opens 2 files, synchronizes them, , saves file location user chooser. works perfect on windows, assumed run on (stupid assumptions...), broken on mac. i've been able fix opening of folders, need saving section fixed. heres code:
function getfolder(strpath string) string dim sitem string dim sfile string dim fldr filedialog set fldr = application.filedialog(msofiledialogfolderpicker) fldr .title = "select folder" .allowmultiselect = false .initialfilename = strpath if .show <> -1 goto nextcode sitem = .selecteditems(1) end nextcode: getfolder = sitem set fldr = nothing sfile = "\" & ssubid & "-" & ssubsession & "-synced.txt" activeworkbook.saveas filename:=sitem & sfile, fileformat:=xltextwindows, createbackup:=false end function
i need able control name of file program (subject's id , session id) need folder save to. i'm pretty knew mac, pick on things relatively quickly. advice appreciated!
for future searchers:
function getfolder(strpath string) string dim sfile string dim folderpath string dim rootfolder string sfile = ssubid & "-" & ssubsession & "-synced.txt" on error resume next rootfolder = macscript("return (path desktop folder) string") folderpath = macscript("(choose folder prompt ""select folder""" & _ "default location alias """ & rootfolder & """) string") on error goto 0 if folderpath <> "" activeworkbook.saveas filename:=folderpath & sfile, fileformat:=xltextwindows, createbackup:=false end if
please note, after few pages on google, stumbled upon site: http://www.rondebruin.nl/mac/section3.htm
Comments
Post a Comment