Creating a new directory to save files

Posted on 2003-03-19
Medium Priority
Last Modified: 2010-05-01
When saving an excel file often times my programming will call for a file to be saved in a directory that doesn't exist.  What is the code necessary for creating a new directory where the Workbook can then be saved?  e.g. at the beginning of a new month the programming will try to save the Workbook in a directory C:\Apr-03 however this directory doesn't exist (unless i manually create it, which is what i am doing now.
Question by:lockbox
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
  • 3
LVL 28

Expert Comment

ID: 8169512
mkdir C:\Apr-03
LVL 28

Accepted Solution

vinnyd79 earned 300 total points
ID: 8169521
forgot the quotes:
mkdir "C:\Apr-03"

Author Comment

ID: 8169618
thanks pal, i knew it had to be something pretty straight forward
LVL 28

Expert Comment

ID: 8169692
you could also check to make sure the directory exists with something like this:

If Dir("C:\Apr-03", vbDirectory) = "" Then MkDir "C:\Apr-03"

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

770 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