+ Reply to Thread
Results 1 to 5 of 5

Open the excel file location (path) in explorer

  1. #1
    Registered User
    Join Date
    10-24-2003
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    32

    Open the excel file location (path) in explorer

    Hi,

    I would like to have a macro button that will open the file location (path were the excel is stored) in MS explorer.

    I found somethink like:

    Sub ExplorePath()
    Shell Environ("windir") & "\Explorer.exe " & ActiveDocument.Path, vbMaximizedFocus
    End Sub

    But that give the error that an object is needed.
    Would that also work for MS Word?

    Thanks for the support.
    Arien

  2. #2
    Forum Contributor
    Join Date
    04-13-2010
    Location
    England
    MS-Off Ver
    Office 2016 365
    Posts
    211

    Re: Open the excel file location (path) in explorer

    Hi,

    Should be as simple as the below....not sure about what it is in word though!

    Sub opend()

    Dim FPath As String

    FPath = Application.ActiveWorkbook.Path

    Shell "explorer.exe " & FPath

    End Sub

  3. #3
    Registered User
    Join Date
    10-24-2003
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    32

    Re: Open the excel file location (path) in explorer

    Many thanks JungleJme,

    That does the job indeed.
    Just one more question as I would like the new explorer screen to be opened active in the front and not hidden in the background.
    Would you have a line for that as well?


    BTW for MS Word I changed ActiveWorksheet to ActiveDocument and it worked as well.

    Thanks again.
    BR, Arien

  4. #4
    Forum Contributor
    Join Date
    04-13-2010
    Location
    England
    MS-Off Ver
    Office 2016 365
    Posts
    211

    Re: Open the excel file location (path) in explorer

    No probs, try the below....

    Sub opend()

    Dim FPath As String

    FPath = Application.ActiveWorkbook.Path

    Shell "explorer.exe " & FPath, vbNormalFocus

    End Sub

  5. #5
    Registered User
    Join Date
    10-24-2003
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    32

    Re: Open the excel file location (path) in explorer

    Great, many thanks!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 09-29-2012, 12:40 PM
  2. Excel Macro to open explorer, open csv file
    By Trubble in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-13-2009, 04:54 AM
  3. File Path Reference to Location of Open Spreadsheet
    By R_S_6 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-01-2009, 11:09 AM
  4. Display open file path/location in toolbar?
    By qz33 in forum Excel General
    Replies: 3
    Last Post: 01-16-2008, 06:52 PM
  5. Replies: 1
    Last Post: 08-05-2006, 04:59 PM

Tags for this Thread

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