Solved

Folder Creator

Posted on 2003-10-24
2
218 Views
Last Modified: 2013-12-03
I need to code to check if a folder exists and if the folder doesnt create it!!! thanx in advance

Text1.Text = the path
0
Comment
Question by:burnttime
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
TwistD_PissR earned 30 total points
ID: 9616059
Dim FSO As Object
Dim sNewFolder As String
   
  sNewFolder = Text1.Text
  Set FSO = CreateObject("Scripting.FileSystemObject")
  If Not FSO.FolderExists(sNewFolder) Then
    FSO.CreateFolder sNewFolder
  End If
  Set FSO = Nothing



TwistD
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 9617295
Why not just use:

If Dir(Text1.Text, vbDirectory) = "" Then MkDir Text1.Text



0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question