+ Reply to Thread
Results 1 to 7 of 7

Problem with MkDir when trying macro on another Machine (Both Using Excell 2010)

  1. #1
    Registered User
    Join Date
    10-05-2012
    Location
    JHB
    MS-Off Ver
    Excel 2010
    Posts
    4

    Problem with MkDir when trying macro on another Machine (Both Using Excell 2010)

    Hey all

    I wrote a macro that amongst other things will create it directory if it doesn't exists. It reads the input from the active workbook out of cell "B3"

    Input Screen.jpg

    I then pick up this input using the following code in VBA

    Please Login or Register  to view this content.
    It then goes on to download attachments from outlook and manipulating the data to finally plot what I need.
    The function to create the directory in question is
    Please Login or Register  to view this content.
    Im aware that VBA can only create one directory level, thus the function.

    The Macro runs fine one my machine, but when I try and run the Macro on another PC, I get the following error

    Error Screen.jpg

    and debugging points me to

    Please Login or Register  to view this content.
    line. I have no Idea what could be wrong. It has to be something with the directory input, access or the way the computers handle it ?? We are using the same Excell 2010 so compatibility is not an issue.

    I hope someone can shed some light on this.

    Thanks
    ExcellMantis

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Problem with MkDir when trying macro on another Machine (Both Using Excell 2010)

    attach the wb file for testing
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    10-05-2012
    Location
    JHB
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Problem with MkDir when trying macro on another Machine (Both Using Excell 2010)

    Hi patel45
    Unfortunately I dont think I can do that since its not a personal thing and is work for a company Im currently employed at.

    The rest of the script only deals with the material it downloads from Outlook. The problem should be around the creating the folder in MkDir. Is there is a setting that needs to be changed that I dont know of ? Privacy or network setting maybe ?

    DataMantis

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Problem with MkDir when trying macro on another Machine (Both Using Excell 2010)

    I personally have had problems with Dir and so I prefer to use the File System Object instead:

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

    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Problem with MkDir when trying macro on another Machine (Both Using Excell 2010)

    Remove your error handling, at a guess, your function is failing.

    You should probably pass something back from your function to say whether it has been successful or not, here's a function I wrote a while ago that does that:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-05-2012
    Location
    JHB
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Problem with MkDir when trying macro on another Machine (Both Using Excell 2010)

    @abousetta and Kyle123

    Thanks, I will give this a try and let you know what the result is.

  7. #7
    Registered User
    Join Date
    10-05-2012
    Location
    JHB
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Problem with MkDir when trying macro on another Machine (Both Using Excell 2010)

    Good morning

    Unfortunately this did not work. Although it improved my function for creating the target folder I still receive the same error promp !

+ 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