Results 1 to 4 of 4

Thread: [RESOLVED] create working directory

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] create working directory

    I have problem here. How I can create working directory?

    I have textbox show this D:\Project\Data.. How I can create folder for this location?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: create working directory

    Code:
    Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" _
    (ByVal lpPath As String) As Long
    
    Private Sub Command1_Click()
    'the will create the directory "d:\project\data"
    'if it doesn't already exist
    MakeSureDirectoryPathExists "d:\project\data\"
    End Sub

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: create working directory

    How If the folder already exist.. How I can tell the user?

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: create working directory

    Code:
    If Dir$("d:\project\data", vbDirectory) <> vbNullString Then
       MsgBox "The Project\Data folder already exists.", vbOKOnly + vbInformation,"No Need To Create"
    Else
       MakeSureDirectoryPathExists "d:\project\data\"
       MsgBox "The Project\Data folder has been created on your D: drive.", vbOKOnly + vbInformation, "Folder Created Successfully"
    End If

Posting Permissions

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



Click Here to Expand Forum to Full Width