branston
02-27-2020, 06:29 AM
Hi
I hope this is an easy question for someone. I am pointing a variable to the "end" part of another filepath ie. the last sub folder name. My filepaths can change and because I am using 'P1' elsewhere in my code I'd rather not change P1 each time. I need P1 to be 'relative'
Dim dA$, P1, strDir$, strDir2$
dA = "C:\temp\Users\Alan\Section2Note1Appendix45\"
P1 = "Section2Note1Appendix45" ???????? (need help here)
strDir = Dir(dA) ?????????
strDir2 = Right(strDir, 10) ???????? (need help here)
P1 needs to be the name of the last folder in dA each time. I need a bit of help with strDir2 above / or a better way. Many thanks in advance.
I hope this is an easy question for someone. I am pointing a variable to the "end" part of another filepath ie. the last sub folder name. My filepaths can change and because I am using 'P1' elsewhere in my code I'd rather not change P1 each time. I need P1 to be 'relative'
Dim dA$, P1, strDir$, strDir2$
dA = "C:\temp\Users\Alan\Section2Note1Appendix45\"
P1 = "Section2Note1Appendix45" ???????? (need help here)
strDir = Dir(dA) ?????????
strDir2 = Right(strDir, 10) ???????? (need help here)
P1 needs to be the name of the last folder in dA each time. I need a bit of help with strDir2 above / or a better way. Many thanks in advance.