changing file path

Patricia0923

New Member
Joined
Mar 18, 2014
Messages
25
Hi,
I need to extract data from files that are currently located down this path

c:\Users\Owner\Desktop\R2D2\Data\NS25465\labor.xls

How do I write code to find and open "labor.xls"?

Can I use ChDir Left(ThisWorkbook.Path, InStr(1, ThisWorkbook.Path, ":"))
ChDir ThisWorkbook.Path
ChDir "..\..\data"

Thank you!
 
Hi Patricia - Have you tried something simple like the code below?

Code:
Sub Patricia0923_OpenFile()
        Workbooks.Open ("c:\Excel\opentest\test3.xlsx")
End Sub
 
Upvote 0
Hi Patricia - Have you tried something simple like the code below?

Code:
Sub Patricia0923_OpenFile()
        Workbooks.Open ("c:\Excel\opentest\test3.xlsx")
End Sub


Thanks.
I am wanting to understand the ..\..\ idea

this spreadsheet has to be used in over 14000 locations
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top