ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening workbook in same directory (https://www.excelbanter.com/excel-programming/404551-opening-workbook-same-directory.html)

Andyjim

Opening workbook in same directory
 
Is the only way to open another workbook programatically from the workbook
that is currently open to use the Workbooks.Open filename:= command to supply
the path and the workbook name? Is there any way you can open another
workbook that resides in the same directory without supply the path?

Thanks much.

Andy

Gary''s Student

Opening workbook in same directory
 
You don't need to hard code the path. Use something like:

fname = "something.xls"
Workbooks.Open Filename:=ThisWorkbook.Path & "\" & fname

--
Gary''s Student - gsnu200765


"Andyjim" wrote:

Is the only way to open another workbook programatically from the workbook
that is currently open to use the Workbooks.Open filename:= command to supply
the path and the workbook name? Is there any way you can open another
workbook that resides in the same directory without supply the path?

Thanks much.

Andy


Andyjim

Opening workbook in same directory
 
Wow.. Good answer. Thanks

"Gary''s Student" wrote:

You don't need to hard code the path. Use something like:

fname = "something.xls"
Workbooks.Open Filename:=ThisWorkbook.Path & "\" & fname

--
Gary''s Student - gsnu200765


"Andyjim" wrote:

Is the only way to open another workbook programatically from the workbook
that is currently open to use the Workbooks.Open filename:= command to supply
the path and the workbook name? Is there any way you can open another
workbook that resides in the same directory without supply the path?

Thanks much.

Andy



All times are GMT +1. The time now is 05:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com