![]() |
Open file with relative reference
Hi, Workbook A and workbook B are two excel files in the same directory, and always will be however the location of that directory may change (ie from 'C:\files\excel' to 'D:\programs\data'. In workbook A, I need a macro that will open workbook B. I have tried the workbooks.open filename('workbook B.xls'). However, this only works if the full location of the file is listed and thus does not work when both the files are shifted to the new directory. Can you please help me to open a workbook with a relative reference to the location. Thannks, Simon -- simonhall ------------------------------------------------------------------------ simonhall's Profile: http://www.excelforum.com/member.php...o&userid=30582 View this thread: http://www.excelforum.com/showthread...hreadid=502291 |
Open file with relative reference
Thisworkbook.path
returns the path of the workbook. The file must be save for it to have a path, but that does not sound like an issue here... -- HTH... Jim Thomlinson "simonhall" wrote: Hi, Workbook A and workbook B are two excel files in the same directory, and always will be however the location of that directory may change (ie from 'C:\files\excel' to 'D:\programs\data'. In workbook A, I need a macro that will open workbook B. I have tried the workbooks.open filename('workbook B.xls'). However, this only works if the full location of the file is listed and thus does not work when both the files are shifted to the new directory. Can you please help me to open a workbook with a relative reference to the location. Thannks, Simon -- simonhall ------------------------------------------------------------------------ simonhall's Profile: http://www.excelforum.com/member.php...o&userid=30582 View this thread: http://www.excelforum.com/showthread...hreadid=502291 |
Open file with relative reference
Hi Jim, Thanks for your reply. The ThisWorkbook.path sounds like a good idea, but I am not sure how to add that information and the filename to the Workbook.Open Filename=() function. Thanks, Simon -- simonhall ------------------------------------------------------------------------ simonhall's Profile: http://www.excelforum.com/member.php...o&userid=30582 View this thread: http://www.excelforum.com/showthread...hreadid=502291 |
All times are GMT +1. The time now is 11:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com