+ Reply to Thread
Results 1 to 5 of 5

get current filepath in excel vba

  1. #1
    matt
    Guest

    get current filepath in excel vba

    i've got a macro that refernces other files. rather than hard code the
    filepath for the folder the excel file is in, is there a way to determine
    the current filepath? it's just that i have different users who have
    different shortcuts to the folder and don't want to hard code.

    cheers in advance
    Matthew



  2. #2
    Dave Peterson
    Guest

    Re: get current filepath in excel vba

    The path of an open workbook?

    msgbox activeworkbook.path 'the activeworkbook
    msgbox thisworkbook.path 'the workbook with the code

    msgbox curdir 'the current directory (when you hit File|open)

    matt wrote:
    >
    > i've got a macro that refernces other files. rather than hard code the
    > filepath for the folder the excel file is in, is there a way to determine
    > the current filepath? it's just that i have different users who have
    > different shortcuts to the folder and don't want to hard code.
    >
    > cheers in advance
    > Matthew


    --

    Dave Peterson

  3. #3
    JE McGimpsey
    Guest

    Re: get current filepath in excel vba

    One way:

    Dim sPath As String
    sPath = ThisWorkbook.Path

    In article <4416d2df$1_1@glkas0286.greenlnk.net>,
    "matt" <matthew hallam> wrote:

    > i've got a macro that refernces other files. rather than hard code the
    > filepath for the folder the excel file is in, is there a way to determine
    > the current filepath? it's just that i have different users who have
    > different shortcuts to the folder and don't want to hard code.
    >
    > cheers in advance
    > Matthew


  4. #4
    Don Guillett
    Guest

    Re: get current filepath in excel vba

    does this help?
    Sub whatisfilepath()
    MsgBox ActiveWorkbook.Path
    End Sub

    --
    Don Guillett
    SalesAid Software
    dguillett1@austin.rr.com
    "matt" <matthew hallam> wrote in message
    news:4416d2df$1_1@glkas0286.greenlnk.net...
    > i've got a macro that refernces other files. rather than hard code the
    > filepath for the folder the excel file is in, is there a way to determine
    > the current filepath? it's just that i have different users who have
    > different shortcuts to the folder and don't want to hard code.
    >
    > cheers in advance
    > Matthew
    >




  5. #5
    matt
    Guest

    Re: get current filepath in excel vba

    thanks, is now sorted
    Matthew

    "matt" <matthew hallam> wrote in message
    news:4416d2df$1_1@glkas0286.greenlnk.net...
    > i've got a macro that refernces other files. rather than hard code the
    > filepath for the folder the excel file is in, is there a way to determine
    > the current filepath? it's just that i have different users who have
    > different shortcuts to the folder and don't want to hard code.
    >
    > cheers in advance
    > Matthew
    >




+ 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