Creating Folder Folder in My Documents VBA - HELP

Discussion in 'Microsoft Excel Programming' started by Ali, Jul 25, 2005.

  1. Ali

    Ali Guest

    Hi,

    I am trying to find out how to create a folder in the My Documents folder.

    I tried looking for system variables that could lead me to the location of
    the my Documents folder, so that I coudl use mkdir and the path, but the
    problem is, the my document is mapped to the server, and not to the
    C:\documents and settings subfolders.

    Will appreciate if i could get some help on this.

    I will eventually want to create folders within the new folder in the My
    Documents.

    Thank you!

    Ali
     
    Ali, Jul 25, 2005
    #1
    1. Advertisements

  2. Ali

    Guest Guest

    I',m not sure ...you could record a macro & record the path that way.
    "usuall" the desktop comes under the users path
    C:\Documents and Settings\username
    however, as with my organisation, teh users desktop is saved on a network,
    privately accessible only bu th euser, so that th euser can log-on from any
    station and have access to the correct applications.




    Sub vars()
    Dim index As Long
    index = 1
    On Error Resume Next
    Do
    Cells(index + 1, 1) = index
    Cells(index + 1, 2) = Environ$(index)
    index = index + 1
    Loop Until Err.Number <> 0
    End Sub




    "Ali" wrote:

    > Hi,
    >
    > I am trying to find out how to create a folder in the My Documents folder.
    >
    > I tried looking for system variables that could lead me to the location of
    > the my Documents folder, so that I coudl use mkdir and the path, but the
    > problem is, the my document is mapped to the server, and not to the
    > C:\documents and settings subfolders.
    >
    > Will appreciate if i could get some help on this.
    >
    > I will eventually want to create folders within the new folder in the My
    > Documents.
    >
    > Thank you!
    >
    > Ali
    >
    >
    >
     
    Guest, Jul 25, 2005
    #2
    1. Advertisements

  3. Ali

    moi Guest

    Use WSHost for getting the full MyDocuments path, change to that dir and
    create a new folder.

    Public Sub addMyDocumentsDir()
    Dim wShell, fso, strFldr As String
    Set wShell = CreateObject("WScript.Shell")
    Set fso = CreateObject("Scripting.FileSystemObject")
    strFldr = wShell.SpecialFolders("MyDocuments")
    ChDir (strFldr)
    fso.CreateFolder ("test123")
    End Sub



    "Ali" <> schreef in bericht
    news:u8$...
    > Hi,
    >
    > I am trying to find out how to create a folder in the My Documents folder.
    >
    > I tried looking for system variables that could lead me to the location of
    > the my Documents folder, so that I coudl use mkdir and the path, but the
    > problem is, the my document is mapped to the server, and not to the
    > C:\documents and settings subfolders.
    >
    > Will appreciate if i could get some help on this.
    >
    > I will eventually want to create folders within the new folder in the My
    > Documents.
    >
    > Thank you!
    >
    > Ali
    >
     
    moi, Jul 25, 2005
    #3
  4. Ali

    Guest Guest

    Thank you!! This worked great!

    "moi" wrote:

    > Use WSHost for getting the full MyDocuments path, change to that dir and
    > create a new folder.
    >
    > Public Sub addMyDocumentsDir()
    > Dim wShell, fso, strFldr As String
    > Set wShell = CreateObject("WScript.Shell")
    > Set fso = CreateObject("Scripting.FileSystemObject")
    > strFldr = wShell.SpecialFolders("MyDocuments")
    > ChDir (strFldr)
    > fso.CreateFolder ("test123")
    > End Sub
    >
    >
    >
    > "Ali" <> schreef in bericht
    > news:u8$...
    > > Hi,
    > >
    > > I am trying to find out how to create a folder in the My Documents folder.
    > >
    > > I tried looking for system variables that could lead me to the location of
    > > the my Documents folder, so that I coudl use mkdir and the path, but the
    > > problem is, the my document is mapped to the server, and not to the
    > > C:\documents and settings subfolders.
    > >
    > > Will appreciate if i could get some help on this.
    > >
    > > I will eventually want to create folders within the new folder in the My
    > > Documents.
    > >
    > > Thank you!
    > >
    > > Ali
    > >

    >
    >
    >
     
    Guest, Jul 25, 2005
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. david2004

    Newbie needs help in VBA ;creating a click() function

    david2004, Jan 8, 2004, in forum: Microsoft Excel Programming
    Replies:
    2
    Views:
    236
    david2004
    Jan 9, 2004
  2. paritoshmehta

    Help with creating a VBA

    paritoshmehta, Mar 4, 2004, in forum: Microsoft Excel Programming
    Replies:
    7
    Views:
    178
    paritoshmehta
    Mar 6, 2004
  3. LP
    Replies:
    0
    Views:
    235
  4. KR

    plz help: creating named range in VBA, loop goes haywire

    KR, Apr 14, 2005, in forum: Microsoft Excel Programming
    Replies:
    2
    Views:
    1,581
    Bob Phillips
    Apr 14, 2005
  5. PeteCresswell

    Creating VBA Functions When Creating Spreadsheet Via VBA?

    PeteCresswell, Jun 15, 2007, in forum: Microsoft Excel Programming
    Replies:
    6
    Views:
    490
    Jon Peltier
    Jun 18, 2007
Loading...

Share This Page