![]() |
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 |
How to create a new folder using Excel VBA?
|
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 |
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