Open files in the same directory

H

houghi

At this moment I use something like:

Set RptWkbk = Workbooks.Open(Filename:="Y:\ALL_USERS\Username\Statistics\Department 01\Individual Report.XLS")
I have another file open in the same directory that does the above and
that works wonders.

However I would like it to point to the file with the name "Individual
Report.XLS", but without the drive and such, so I can send it to people
who are on a different machine.

I tried the following, but it did not work:
Set RptWkbk = Workbooks.Open(Filename:="Individual Report.XLS")

Probably prety basic stuff, but I can't seem to figure it out.

houghi
 
D

Dave Peterson

Can you make sure that the workbook is in the same folder as the workbook
running the code:

Set RptWkbk = Workbooks.Open(Filename:=thisworkbook.path & "\" & _
"Individual Report.XLS")

or if you know that file is in the same workbook that is currently active

Set RptWkbk = Workbooks.Open(Filename:=activeworkbook.path & "\" & _
"Individual Report.XLS")
 
H

houghi

Dave said:
Can you make sure that the workbook is in the same folder as the workbook
running the code:

Set RptWkbk = Workbooks.Open(Filename:=thisworkbook.path & "\" & _
"Individual Report.XLS")

Works great, thanks.

houghi
 

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