[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Create and delete folder using VBA

Posted on 2007-10-02
6
Medium Priority
?
1,282 Views
Last Modified: 2013-11-28
Hi All
I need some code that will create a folder on the C drive after i've done what i needed i need to delete the folder again. I need to do this with VBA from a button on an Access Form.
Thanks in advance
Elmo
0
Comment
Question by:cErasmus
  • 2
  • 2
  • 2
6 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 19997437
You can use the MkDir to build a folder:

MkDir "C:\SomeFolder"

You can use Kill to remove it:

Kill "C:\SomeFolder"

0
 
LVL 1

Author Comment

by:cErasmus
ID: 19997441
Got the create part done. Just need to be able to delete it now.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 19997445
  Dim fsys As New Scripting.FileSystemObject
      fsys.CreateFolder "C:\Myfolder"

'Do your stuff

    fsys.DeleteFolder "C:\Myfolder", True

Needs tools -> references, check MS scripting runtime
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 61

Expert Comment

by:mbizup
ID: 19997448
Posted too late.  LSM posted what you need.
0
 
LVL 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 19997449
Sorry ... got ahead of myself ... you can't remove a Folder using Kill (that's for Files). Use rmdir:

rmdir "C:\SomeFolder"

Note that the folder must be empty ...
0
 
LVL 1

Author Comment

by:cErasmus
ID: 19997488
Thanks for all the quick responces
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

830 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