k13r4n
01-07-2009, 05:58 PM
So i have the filname and location in a string and i want to chop the filename off so i just have the folder.
E.G. "S:\CompanyServer\Mydepartment\MyWork\ScriptFile.scr" becomes S:\CompanyServer\Mydepartment\MyWork
i cant just use Left(Filename, #) because the length of the string depends were the user saves the file and what filename they use.
any ideas?
Ive searched for an answer to this one on and off for a while and can't find anything.
Cheers
Kieran :thumb
Edit: Forgot to mention this is for setting ChDir (), as for 'why', its a very long explination and is more of a "it would be nice if it did this.." request from one of the people that use the spreadsheet. Im not a VBA guru or anything. Someone at work mentioned to the boss that i did a bit of web development on the side and so i got landed with writing some VBA to Automate a few things, im pretty much making it up as i go along *groan*
E.G. "S:\CompanyServer\Mydepartment\MyWork\ScriptFile.scr" becomes S:\CompanyServer\Mydepartment\MyWork
i cant just use Left(Filename, #) because the length of the string depends were the user saves the file and what filename they use.
any ideas?
Ive searched for an answer to this one on and off for a while and can't find anything.
Cheers
Kieran :thumb
Edit: Forgot to mention this is for setting ChDir (), as for 'why', its a very long explination and is more of a "it would be nice if it did this.." request from one of the people that use the spreadsheet. Im not a VBA guru or anything. Someone at work mentioned to the boss that i did a bit of web development on the side and so i got landed with writing some VBA to Automate a few things, im pretty much making it up as i go along *groan*