View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Open folder based on cell value

burl_h wrote on 1/28/2012 :
I just figured it out (how to chnage the date "month/day/year" to
"month-day-year" the following works nicely

Dim lRow As Long
lRow = ActiveCell.Row
Const sInitPath As String = "C:\Users\Public\Pictures\" '//main path
'Add subfolder[s]
strpath = sInitPath & Cells(lRow, "B") & "\" & Format(Cells(lRow,
"C").Value, "MM-DD-YY") & "\"

strfile = Dir(strpath & "\*.jpg")

Garry, thanks for all your help.

Burl_h


You're welcome! However, if you persist to add the trailing backslash
on the path string then you should remove it from the start of the file
extension string. I deliberately put it here because paths normally do
not contain the trailing backslash.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc