ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to create a new folder using Excel VBA? (https://www.excelbanter.com/excel-programming/357516-how-create-new-folder-using-excel-vba.html)

Paul

How to create a new folder using Excel VBA?
 
My users may or may not have a folder called "C:\Audits".
When they run a certain macro, it should check to see if the folder exists,
and if it does not, create it and then save As the open Excel workbook to the
Audit folder under a new name.

Any ideas on how to check for/create the Audit folder from within Excel?

TIA
Paul


Kletcho

How to create a new folder using Excel VBA?
 
Check out this previous discussion:

http://groups.google.com/group/micro...d28cd18af11e58


Jim Thomlinson

How to create a new folder using Excel VBA?
 
This should work for you...

On Error Resume Next
MkDir ("C:\Audit")
On Error GoTo 0
--
HTH...

Jim Thomlinson


"Paul" wrote:

My users may or may not have a folder called "C:\Audits".
When they run a certain macro, it should check to see if the folder exists,
and if it does not, create it and then save As the open Excel workbook to the
Audit folder under a new name.

Any ideas on how to check for/create the Audit folder from within Excel?

TIA
Paul


windsurferLA

How to create a new folder using Excel VBA?
 
The prior replies would probably work..
You could also use variations on the following to test for existence of
directory. It would be true if no directory exists and a Make Directory
command would be appropriate.
If dir(€śC:\Audits€ť)< €śC:\Audits€ť


Paul wrote:
My users may or may not have a folder called "C:\Audits".
When they run a certain macro, it should check to see if the folder exists,
and if it does not, create it and then save As the open Excel workbook to the
Audit folder under a new name.

Any ideas on how to check for/create the Audit folder from within Excel?

TIA
Paul



All times are GMT +1. The time now is 11:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com