ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open file in directory (https://www.excelbanter.com/excel-programming/292008-open-file-directory.html)

mike

Open file in directory
 
Hi. The following code will open a file in a specific
directory. After I complete the development of this
file, I plan to move it along with the other file to
another computer. At this point, I don't know the entire
path on the new computer, but I do know that both files
will reside in the same directory.

How would I rewrite this line so that it will open the
file in the same directory as that which the macro file
is located?

Workbooks.Open Filename:= _
"C:\Documents and Settings\Mike\My
Documents\Demos Log file.xls"

Thanks,
Mike.



Tom Ogilvy

Open file in directory
 
Workbooks.Open Filename:= _
ThisWorkbook.Path & "\" & "Demos Log file.xls"

--
Regards,
Tom Ogilvy

"Mike" wrote in message
...
Hi. The following code will open a file in a specific
directory. After I complete the development of this
file, I plan to move it along with the other file to
another computer. At this point, I don't know the entire
path on the new computer, but I do know that both files
will reside in the same directory.

How would I rewrite this line so that it will open the
file in the same directory as that which the macro file
is located?

Workbooks.Open Filename:= _
"C:\Documents and Settings\Mike\My
Documents\Demos Log file.xls"

Thanks,
Mike.





Mike.

Open file in directory
 
Thanks, Tom.

-----Original Message-----
Workbooks.Open Filename:= _
ThisWorkbook.Path & "\" & "Demos Log file.xls"

--
Regards,
Tom Ogilvy

"Mike" wrote in

message
...
Hi. The following code will open a file in a specific
directory. After I complete the development of this
file, I plan to move it along with the other file to
another computer. At this point, I don't know the

entire
path on the new computer, but I do know that both files
will reside in the same directory.

How would I rewrite this line so that it will open the
file in the same directory as that which the macro file
is located?

Workbooks.Open Filename:= _
"C:\Documents and Settings\Mike\My
Documents\Demos Log file.xls"

Thanks,
Mike.




.



All times are GMT +1. The time now is 07:03 AM.

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