+ Reply to Thread
Results 1 to 11 of 11

set filepath for MkDir function

  1. #1
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    set filepath for MkDir function

    I have the below code to create a folder and was wondering if it was possible to set the file path so I can call it rather than have to define it several times (I may need to change this based on computer using it).

    P.s. HR is a Userform & Forename/Surname are textboxes.

    Please Login or Register  to view this content.
    I was trying something like the below but it didn't work

    Please Login or Register  to view this content.

  2. #2
    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: set filepath for MkDir function

    Hello Sc0tt1e,

    Remove the quotes from around "HR.Forename" and "HR.Surname". This is reference to an object that returns a String data type.
    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!)

  3. #3
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: set filepath for MkDir function

    I tried the below but I still get an object required error

    Please Login or Register  to view this content.

  4. #4
    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: set filepath for MkDir function

    Hello Sc0tt1e,

    I should have mentioned your user form needs to be loaded or visible before this macro will work.

  5. #5
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: set filepath for MkDir function

    I'm getting a compile error message saying "Member already exists in an object module form which this object module derives".

    I have no idea what this means

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: set filepath for MkDir function

    Kind of says what it means.

    You must have added/created/named something that you've used somewhere else.

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.
    If posting code please use code tags, see here.

  7. #7
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: set filepath for MkDir function

    It's got to the point where this is a really complex document, loading a copy usually confuses the hell out of people but here goes.

    You are looking at the code within the HR Userform
    Attached Files Attached Files

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

    Re: set filepath for MkDir function

    In a standard code module:

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: set filepath for MkDir function

    Thanks shg but I'm happy with the solution I have for now, would love to know why I'm getting this new error though?

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: set filepath for MkDir function

    Sc0tt1e

    Care to share the solution?

  11. #11
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: set filepath for MkDir function

    Leiths suggestion gives me the following code but it works only when I remove the SetUp module code. I want to know why it keeps coming up with the error message and highlighting the
    Please Login or Register  to view this content.
    bit of the code in the SetUp module.

    Please Login or Register  to view this content.
    Last edited by Sc0tt1e; 09-29-2014 at 08:46 PM.

+ 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. [SOLVED] Trying to get the filepath on "Open", but get filepath of a temporary file instead
    By ianpwilliams in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-22-2013, 12:27 AM
  2. [SOLVED] Copying files from a selected filepath to a filepath mentioned in a worksheet's cell
    By subbby in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2012, 03:59 PM
  3. MkDir with cell value as folder name.
    By tdo4h in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 08-24-2012, 06:37 AM
  4. MkDir not working
    By pprseller in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-23-2009, 12:47 PM
  5. [SOLVED] MKDir not working
    By Robert_L_Ross in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2006, 02:20 AM

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