+ Reply to Thread
Results 1 to 2 of 2

setting filepath to current drive- not fully qualified

Hybrid View

  1. #1
    Registered User
    Join Date
    01-23-2014
    Location
    Denver, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    36

    setting filepath to current drive- not fully qualified

    Hey Guys,

    I'm looking to set a filepath to refer to the current drive/drive of the excel workbook.
    Reasoning is macro is accessed from VPN, drive names are all different and multiples people run macro
    Is there a way to set the drivename in the path to the current drive (as used in the file running the macro)?
    for example

    person 1.
    drive is z drive, (rest of file-path is same), the current folder is in their z drive
    Workbooks.Open Filename:="Z:\Reports\data\report 1.csv"
    person 2.
    M drive
    Workbooks.Open Filename:="M:\Reports\data\report 1.csv"
    etc

    merging these into one code
    Workbooks.Open Filename:="Current drive:\Reports\data\report 1.csv"


    Is this possible??


    Thanks

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: setting filepath to current drive- not fully qualified

    Some things to try:

    Workbooks.Open Filename:= ThisWorkbook.Path & "\report 1.csv"
    Workbooks.Open Filename:= ActiveWorkbook.Path & "\report 1.csv"
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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: 0
    Last Post: 04-14-2014, 02:12 AM
  2. Replies: 0
    Last Post: 04-26-2011, 02:12 PM
  3. Replies: 4
    Last Post: 07-19-2010, 09:05 AM
  4. [SOLVED] get current filepath in excel vba
    By matt in forum Excel General
    Replies: 4
    Last Post: 03-14-2006, 11:50 AM
  5. Replies: 3
    Last Post: 03-09-2006, 02:10 PM

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