Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding a folder with code
How do I create a folder, if one does not exist, using VBA in Excel when the
workbook is opened and not create a folder if the specified folder already exists? -- Tyrell Fickenscher Plant Manager / Agronomist |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding a folder with code
On Error Resume Next
mkdir "C:\MyFolder" On Error goto 0 this assumes the existence of only the last folder in the chain is in question. -- Regards, Tom Ogilvy "Tyrell" wrote in message ... How do I create a folder, if one does not exist, using VBA in Excel when the workbook is opened and not create a folder if the specified folder already exists? -- Tyrell Fickenscher Plant Manager / Agronomist |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding a folder with code
Give this a whirl...
Sub test() On Error GoTo MakeDirectory ChDir ("C:\Test2") On Error GoTo 0 Exit Sub MakeDirectory: MkDir "C:\Test2" Resume Next End Sub -- HTH... Jim Thomlinson "Tyrell" wrote: How do I create a folder, if one does not exist, using VBA in Excel when the workbook is opened and not create a folder if the specified folder already exists? -- Tyrell Fickenscher Plant Manager / Agronomist |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding a folder with code
I just try to create it and ignore any error message.
on error resume next mkdir "C:\myfolder" on error goto 0 Tyrell wrote: How do I create a folder, if one does not exist, using VBA in Excel when the workbook is opened and not create a folder if the specified folder already exists? -- Tyrell Fickenscher Plant Manager / Agronomist -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding a file to xlstart folder. | Excel Discussion (Misc queries) | |||
Need code to save file to new folder, erase from old folder | Excel Discussion (Misc queries) | |||
Adding a folder | Excel Programming | |||
Adding file name and path to to footer of all workbooks in a folder. | Excel Programming | |||
Opening A Folder Using VB Code | Excel Programming |