how to open workbook without hardcoding path

M

Michael Turner

Hi

Could anyone tell me how to open a workbook from another workbook, where
both files are in the same folder, without hardcoding the path. I have tried
code like this without success.
Workbooks.open (path & "\somefile.xls")

Thanks in advance
Mick
 
P

Paul Robinson

Hi,
Try
Workbooks.open (ThisWorkbook.path & "\somefile.xls")

ThisWorkbook in VBA is the one containing the code.

regards
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top