input box finds and opens folder in windows explorer -
the problem:
i have 10,000 numbered folders. example:
root/7000-8000/7400/7473/
root/3000-4000/3800/3846/
these network folders "unit folders" contain documents, design, photos, accounting, etc data each "unit" company sells. these documents organized subdirectory. dozens of employees refer these folders hundreds of times per day. tedious drill down folder looking for.
what want:
i want create simple input box, user has enter in unit number, lets between 1 , 100,000, , press enter. system automatically open corresponding "unit folder".
how:
i looking me figure out scripting language need learn done, functions in particular should into, , deal-breakers should know about.
i need sort of input box, simpler better, can stay on desktop or in taskbar. next need parse input digits, , break them down thousands, hundreds, tens, etc. need assemble variables target folder, create correct command send explorer. lastly need issue error if went wrong.
thanks in advance advise!
we got figured out. code attached below if else comes across this:
option explicit private function checkpath(strpath string) boolean dim fso new filesystemobject if fso.folderexists(strpath) checkpath = true else checkpath = false end if end function '''''''''''''''''' private sub cmdgo_click() dim unit double 'unit number dim unitth integer 'for thousand of unit dim unithu integer 'for hundred of unit dim locationstring string 'for string store folder location dim exists boolean 'ensure folder exists locationstring = "z:\unit folders\" if val(txtunit.text) > 90000 unit = val(txtunit.text) - 90000 unithu = fix(unit / 100) locationstring = locationstring & "rtb90000-90999\rtb" locationstring = locationstring & "90" & unithu & "00" locationstring = locationstring & "\rtb90" & unit & "\" else unit = val(txtunit.text) unitth = fix(unit / 1000) if unit > 10000 unitth = unitth + 10 end if unithu = fix((unit - unitth * 1000) / 100) locationstring = locationstring & unitth & "000-" & unitth & "999\" locationstring = locationstring & unitth & unithu & "00" locationstring = locationstring & "\" & unit & "\" end if exists = (checkpath(locationstring)) dim x if exists x = shell("c:\windows\explorer.exe " & locationstring, vbnormalfocus) else msgbox ("folder not exist") end if end sub
Comments
Post a Comment