+ Reply to Thread
Results 1 to 3 of 3

Local Directory File Access

  1. #1
    Alejandro
    Guest

    Local Directory File Access

    Hello all,

    I am trying to get a macro to open a file in the same directory as the xl
    file being launched. The code I am using is:
    Workbooks.Open Filename:="DB-Data.xls"

    For some reason it doesn't want to find it [although the help file says that
    it should]. If I give it a full path, it has no problem. Is it possible to
    do this? My goal is to get these workbooks available on CD for people to
    work at home.

    Thanks,
    -=Alejandro



  2. #2
    Jim Thomlinson
    Guest

    RE: Local Directory File Access

    Thisworkbook.path

    will give you the path to the workbook running the code...
    --
    HTH...

    Jim Thomlinson


    "Alejandro" wrote:

    > Hello all,
    >
    > I am trying to get a macro to open a file in the same directory as the xl
    > file being launched. The code I am using is:
    > Workbooks.Open Filename:="DB-Data.xls"
    >
    > For some reason it doesn't want to find it [although the help file says that
    > it should]. If I give it a full path, it has no problem. Is it possible to
    > do this? My goal is to get these workbooks available on CD for people to
    > work at home.
    >
    > Thanks,
    > -=Alejandro
    >
    >
    >


  3. #3
    Alejandro
    Guest

    Re: Local Directory File Access

    Jim,

    Thanks for the suggestion! That helped a lot. It works now, with the
    addition of a '\' in front of the file name in the code, as such:
    Workbooks.Open Filename:=(ThisWorkbook.Path & "\DB-Data.xls")

    It worked great!

    -=Alejandro

    "Jim Thomlinson" <[email protected]> wrote in message
    news:[email protected]...
    > Thisworkbook.path
    >
    > will give you the path to the workbook running the code...
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "Alejandro" wrote:
    >
    >> Hello all,
    >>
    >> I am trying to get a macro to open a file in the same directory as the xl
    >> file being launched. The code I am using is:
    >> Workbooks.Open Filename:="DB-Data.xls"
    >>
    >> For some reason it doesn't want to find it [although the help file says
    >> that
    >> it should]. If I give it a full path, it has no problem. Is it possible
    >> to
    >> do this? My goal is to get these workbooks available on CD for people to
    >> work at home.
    >>
    >> Thanks,
    >> -=Alejandro
    >>
    >>
    >>




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1