Consulting

Results 1 to 10 of 10

Thread: Mkdir

  1. #1
    VBAX Regular
    Joined
    Mar 2007
    Posts
    47
    Location

    Mkdir

    Hello!

    can somebody explain to me, why I am getting error on this (path not found):

    MkDir Environ("HOMEPATH") + "try"

    msgbox shows it correctly...

    Thank you

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Should it be

    [vba]

    MkDir Environ("HOMEPATH") & Application.PathSeparator & "try"
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Mar 2007
    Posts
    47
    Location
    Quote Originally Posted by xld
    Should it be

    [vba]

    MkDir Environ("HOMEPATH") & Application.PathSeparator & "try"
    [/vba]
    hmm... i already tried that... still doesn't work...

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    What does MkDir Environ("HOMEPATH") alone give you?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    Mar 2007
    Posts
    47
    Location
    Quote Originally Posted by xld
    What does MkDir Environ("HOMEPATH") alone give you?
    path not found

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    So that suggest that you don't have such a variable set up does it not, so you cannot use it.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    How about trying this

    [vba]

    MkDir CreateObject("WScript.Shell").SpecialFolders(16) & application.PathSeparator & "try"
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  8. #8
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    I think you need:
    [VBA]MkDir Environ("HOMEDRIVE") & Environ("HOMEPATH") & Application.PathSeparator & "try"[/VBA]
    Regards,
    Rory

    Microsoft MVP - Excel

  9. #9
    VBAX Regular
    Joined
    Mar 2007
    Posts
    47
    Location
    thanx to all! it is working now!

  10. #10
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    "USERPROFILE" works for me.

    For a listing, try
    [VBA]Sub MyEnvirons()
    For i = 1 To 100
    Cells(i, 1) = Environ(i)
    Next
    End Sub

    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •