How to Open file in VBA thats NOT in my C drive, but in my P drive?

mfische

New Member
Joined
Feb 17, 2015
Messages
8
I used this line:

Workbooks.Open ("C:\Timesheet_stuff\February.xlsx")

And it opens up that file...
However, when I try to open up that same file that's in my P: drive (personal drive) it says it cant find it..

Workbooks.Open ("P:\Timesheet_stuff\February.xlsx")



Does anybody know of issues with opening up workbooks outside of the C: drive? This makes no sense..
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
is the P:\ drive a network drive this could mean you don't currently have connection

you could try these commands in the code ( yes i know 2 lines instead of one)

Code:
chdir (P:\Timesheet_stuff\)

Workbooks.Open ("February.xlsx")
 
Upvote 0
Thanks! That got it to work. Final code is now:

ChDir "P:\Timesheet_stuff"

Workbooks.Open ("February")
 
Upvote 0

Forum statistics

Threads
1,216,222
Messages
6,129,586
Members
449,520
Latest member
TBFrieds

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