ChrisBurch
IS-IT--Management
I am automating a serires of Excel files. So far I have been able to programatically generate the filename, and set the saveas path to a sub-directory of the current directory, but need to be able to pickup up the directory path higher up.
eg. using ActiveWorkbook.path might give me
T:\departments\accounts\acntmgr\customer\difot and I can saveas T:\departments\accounts\AcntMgr\customer\difot\images\filename.xls. My problem is that I need to be able to save to a subfolder of \AcntMgr which will always be two directories higher that my current level. I don't want to hardcode the path, in case the files are moved to another drive or folder. However, since the current folder will always be 2 levels down from \AcntMgr how can I strip off the last 2 folders from the string returned by ActiveWorkbook.path?
Thanks for any advice,
Chris
It worked yesterday.
It doesn't work today.
That's Windows!
eg. using ActiveWorkbook.path might give me
T:\departments\accounts\acntmgr\customer\difot and I can saveas T:\departments\accounts\AcntMgr\customer\difot\images\filename.xls. My problem is that I need to be able to save to a subfolder of \AcntMgr which will always be two directories higher that my current level. I don't want to hardcode the path, in case the files are moved to another drive or folder. However, since the current folder will always be 2 levels down from \AcntMgr how can I strip off the last 2 folders from the string returned by ActiveWorkbook.path?
Thanks for any advice,
Chris
It worked yesterday.
It doesn't work today.
That's Windows!