![]() |
Directory Programming
Hello,
I have been asked to develop an Excel project, and need some help. I've listed the specs below * I am running Excel/Office xp/2002 on my machine, however, I have to save the excel file back to excel 95 format * My brief is to...."re-develop code to work from current directory and not physcial directory". Currently, examples of the vb code in place in macro's is.... ChDrive "C" ChDir "C:\Applications\ApplA1\Data" ChDrive "C" ChDir "C:\Applications\ApplA2\Billing" BUT, once i've finished re-developing it, and handover, mary may take the files and install on, say g:\currentwork\applications. Fred could install it on his machine on y:\officefiles\applications. I just dont know where each user will install it on their pc. Many users = hundreds of possible locations What I need, is to replace the two lines of code above, so that it picks up on a)which drive the files are stored on. The user will open a main xls file first, which they will locate on whatever directory on their hard drive its on by browsing in windows explorer, or a desktop icon, and double clicking, so the main file will be opened from it's location on the hard drive, and b)so that it "logs" to the correct directory. I cant "hard code" in chdir to marys g:\currentwork directory, or freds y:\officefiles, as I simply wont know which directory each user installs to Thankyou in advance, remembering, I open the files in excel 2002, but HAVE to save back to excel 95 format Jeff |
Directory Programming
Jeff,
ThisWorkbook.Path will get you a string containing the file path to the folder containing your file. Whether this will work in Excel 95, I have absolutely no idea. Cheers, Pete -----Original Message----- Hello, I have been asked to develop an Excel project, and need some help. I've listed the specs below * I am running Excel/Office xp/2002 on my machine, however, I have to save the excel file back to excel 95 format * My brief is to...."re-develop code to work from current directory and not physcial directory". Currently, examples of the vb code in place in macro's is.... ChDrive "C" ChDir "C:\Applications\ApplA1\Data" ChDrive "C" ChDir "C:\Applications\ApplA2\Billing" BUT, once i've finished re-developing it, and handover, mary may take the files and install on, say g:\currentwork\applications. Fred could install it on his machine on y:\officefiles\applications. I just dont know where each user will install it on their pc. Many users = hundreds of possible locations What I need, is to replace the two lines of code above, so that it picks up on a)which drive the files are stored on. The user will open a main xls file first, which they will locate on whatever directory on their hard drive its on by browsing in windows explorer, or a desktop icon, and double clicking, so the main file will be opened from it's location on the hard drive, and b)so that it "logs" to the correct directory. I cant "hard code" in chdir to marys g:\currentwork directory, or freds y:\officefiles, as I simply wont know which directory each user installs to Thankyou in advance, remembering, I open the files in excel 2002, but HAVE to save back to excel 95 format Jeff |
All times are GMT +1. The time now is 04:18 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com