+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : VBA for finding the filepath of the current open workbook

  1. #1
    Registered User
    Join Date
    07-16-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    8

    VBA for finding the filepath of the current open workbook

    I'm trying to write code that will look at the filepath of the workbook I am currently in and enters it into a given cell (say A1) for reference in the following code:


    Please Login or Register  to view this content.
    In other words, the file path you see above, I need to generate that automatically so that no matter what file I am in the Macro can be run.... hope this makes sense!

    Thanks guys!
    Last edited by jrodlc08; 07-16-2010 at 02:04 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: VBA for finding the filepath of the current open workbook

    Please Login or Register  to view this content.
    ... return the path.

    Please change your QUOTE tags to CODE tags.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    07-16-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: VBA for finding the filepath of the current open workbook

    Let me show you my entire code and tell you a little more about what I'm trying to do. What I am doing is taking an open Workbook with multiple tabs, stripping out neccessary data and pasting it into a NEW workbook, save the new document as the same name as the Master file I have stripped the data from all under Macro control. What I would like to do is take the file path of the exisintg file and have it dumped into a cell in the Master file and then copied into the NEW workbook that contains the stripped out data and then instead of my hard coded path you see below at the bottom of the code, have that reference the cell that the filepath has been copied to as the new name. I'm very new to all of this and I'm sure there is a much easier way to go about doing this so all help is greatly appreciated.



    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-16-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: VBA for finding the filepath of the current open workbook

    anyone have any help for me on this one??

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,979

    Re: VBA for finding the filepath of the current open workbook

    I'm not really clear on why shg's answer doesn't help you?
    Everyone who confuses correlation and causation ends up dead.

+ 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