+ Reply to Thread
Results 1 to 6 of 6

Identify Full Path of Opened Excel Workbook

  1. #1
    monir
    Guest

    Identify Full Path of Opened Excel Workbook

    In a VBA Excel macro, how can I identify the full path of "this" opened
    workbook test1.xls, and then use it to open another file test2.xls at the
    same location ?

    Will the procedure change the current folder in the File menu ?

    Thank you.

  2. #2
    Bob Phillips
    Guest

    Re: Identify Full Path of Opened Excel Workbook

    Activeworkbook.Path

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "monir" <monir@discussions.microsoft.com> wrote in message
    news:E3F453B6-DD62-4C5D-B859-2EA36CB6C1C9@microsoft.com...
    > In a VBA Excel macro, how can I identify the full path of "this" opened
    > workbook test1.xls, and then use it to open another file test2.xls at the
    > same location ?
    >
    > Will the procedure change the current folder in the File menu ?
    >
    > Thank you.




  3. #3
    Dana DeLouis
    Guest

    Re: Identify Full Path of Opened Excel Workbook

    Here's one of a few ways:

    Sub Demo()
    Dim v
    Dim WbToOpen
    Dim ps As String

    ps = Application.PathSeparator

    v = Split(ThisWorkbook.FullName, ps)
    v(UBound(v)) = "Test2.xls"
    WbToOpen = Join(v, ps)
    ' etc...
    End Sub

    HTH
    --
    Dana DeLouis
    Win XP & Office 2003


    "monir" <monir@discussions.microsoft.com> wrote in message
    news:E3F453B6-DD62-4C5D-B859-2EA36CB6C1C9@microsoft.com...
    > In a VBA Excel macro, how can I identify the full path of "this" opened
    > workbook test1.xls, and then use it to open another file test2.xls at the
    > same location ?
    >
    > Will the procedure change the current folder in the File menu ?
    >
    > Thank you.




  4. #4
    Tim Williams
    Guest

    Re: Identify Full Path of Opened Excel Workbook

    workbooks.open thisworkbook.path & "\test2.xls"

    Tim


    "monir" <monir@discussions.microsoft.com> wrote in message
    news:E3F453B6-DD62-4C5D-B859-2EA36CB6C1C9@microsoft.com...
    > In a VBA Excel macro, how can I identify the full path of "this"
    > opened
    > workbook test1.xls, and then use it to open another file test2.xls
    > at the
    > same location ?
    >
    > Will the procedure change the current folder in the File menu ?
    >
    > Thank you.




  5. #5
    Tom Ogilvy
    Guest

    Re: Identify Full Path of Opened Excel Workbook

    sPath = Activeworkbook.Path

    --
    Regards,
    Tom Ogilvy

    "monir" <monir@discussions.microsoft.com> wrote in message
    news:E3F453B6-DD62-4C5D-B859-2EA36CB6C1C9@microsoft.com...
    > In a VBA Excel macro, how can I identify the full path of "this" opened
    > workbook test1.xls, and then use it to open another file test2.xls at the
    > same location ?
    >
    > Will the procedure change the current folder in the File menu ?
    >
    > Thank you.




  6. #6
    monir
    Guest

    Re: Identify Full Path of Opened Excel Workbook

    Bob, Dana, Tim, Tom;

    Very helpful! Thank you all.



+ 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