+ Reply to Thread
Results 1 to 11 of 11

mapped driver macro option

  1. #1
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    mapped driver macro option

    http://www.excelforum.com/excel-prog...ml#post2036724

    Hi

    with help from the forum I finally completed a macro that would loop through selected workbooks in a folder and pull results to be shown in a new workbook.

    This works fine by using a worksheet where the files are listed and in a1 of the worksheet, the path to the folder.

    We have one workstation on the LAN with restricted access to the server, and therefore has mapped drives. Therefore the path to the folder containing the workbooks is different.

    How could I instruct the macro when invoked - so in the case of that workstation - if the macro cannot find the files at the path stated in a1 of the workbook, it is to try a different location (The folder containing the workbooks is actually Drive:T)

    Any help appreciated.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: mapped driver macro option

    Heres several ways

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

    More methods
    http://www.rondebruin.nl/exist.htm
    Last edited by mudraker; 02-03-2009 at 07:43 AM.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: mapped driver macro option

    Hi Mudraker

    I see how I can direct the macro to look at an alternative path - but - the problem I have is that the sheet which contains the list of workbooks has the path to these workbooks entered in cell a1 (see nigel1.xls)

    would I have to create a nigel2.xls with the mapped driver details in it ??

  4. #4
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Alternate file path within macro

    Hi

    a macro which srcrolls through several workbooks to produce a "fault file" workbook in a subfolder works OK.

    I have one workstation with restricted access to LAN that has mapped drives, on the suggestion of a forum member I entered the following to "re-direct" the macro should it be invoked from this workstation.

    It seems to work BUT I cannot get it to then seek the alternative subfolder for the target file. These are

    from any ws
    P:\My Documents\trailer files 2008\fault sheets
    from restricted ws
    V:\fault sheets

    I tried to repeat the code for the first instance but it doesnt like it. Any suggestions
    Please Login or Register  to view this content.
    Last edited by nigelog; 02-05-2009 at 05:56 AM.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Alternate file path within macro

    Hello nigelog,

    The argument vbDirectory is used only when the preceding argument is a folder path to be checked. To check for the existence of a file, you don't need an additional argument.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  6. #6
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Alternate file path within macro

    Hi Leith

    have noted your comment and ammended that section of macro. Where I have the problem is further into the macro

    1. When the macro calls the wsheet "FILE LIST", the cell a1 contains the path to the other workbooks ie: "P:\My Documents\Trailer Files 2008\"


    This would need the option of "V:\"

    2. The created target workbook P:\My Documents\Trailer Files 2008\Fault Sheets\Fault File .xls

    Would also need an option of V:\Fault Sheets\Fault File.xls

    Any Help Appreciated

    Rgds Nigel

  7. #7
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: mapped driver macro option

    Bump - no answer as yet

  8. #8
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: mapped driver macro option

    Same concept using DIR() as you did for the file.
    Please Login or Register  to view this content.

  9. #9
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: mapped driver macro option

    Quote Originally Posted by Kenneth Hobson View Post
    Same concept using DIR() as you did for the file.
    Please Login or Register  to view this content.

    Hi Kenneth, you have this line commented out. Just wanted to check if this was your intention.

    Many thanks Nigel O'Gorman

  10. #10
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: mapped driver macro option

    Yes, I left it so that you could see what the value might be. You can delete it.

    Comments can always be deleted but sometimes at the cost of knowing what your was doing at some point when you review your code in the future.

    Obviously, there are other issues that might arise. e.g. Even the V:\ drive does not exist, the sheet does not exist, no value in A1, etc.

  11. #11
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: mapped driver macro option

    Quote Originally Posted by Kenneth Hobson View Post
    Yes, I left it so that you could see what the value might be. You can delete it.

    Comments can always be deleted but sometimes at the cost of knowing what your was doing at some point when you review your code in the future.

    Obviously, there are other issues that might arise. e.g. Even the V:\ drive does not exist, the sheet does not exist, no value in A1, etc.
    Kenneth
    Thanks for reply, I will try to get working in the morning and post results,

+ 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