Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to determine if a Folder/Directory Exists in Excel VBA
Hi All,
Does anybody know how i can determine if a directory exists in VBA? For example i would like to write a function that looks to see if the path c:\reports\2006 exists, if so leave it be, if not create it. Thanks, Bill |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to determine if a Folder/Directory Exists in Excel VBA
Why bother checking. Just ignore any errors that occur when you try to create
it: on error resume next mkdir "C:\reports" mkdir "C:\reports\2006" on error goto 0 (One level at a time.) wrote: Hi All, Does anybody know how i can determine if a directory exists in VBA? For example i would like to write a function that looks to see if the path c:\reports\2006 exists, if so leave it be, if not create it. Thanks, Bill -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to determine if a Folder/Directory Exists in Excel VBA
Bill,
Dave's answer is native VBA, but there's also the API route: <From API-Guide: URL: http://www.allapi.net/ Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal lpPath As String) As Long Private Sub Form_Load() 'create the directory "c:\this\is\a\test\directory\", if it doesn't exist already MakeSureDirectoryPathExists "c:\this\is\a\test\directory\" End Sub </From API-Guide: NickHK wrote in message oups.com... Hi All, Does anybody know how i can determine if a directory exists in VBA? For example i would like to write a function that looks to see if the path c:\reports\2006 exists, if so leave it be, if not create it. Thanks, Bill |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Folder/Directory listings saved in Excel? | Excel Discussion (Misc queries) | |||
Check if folder exists, if yes just copy sheet in to folder? | Excel Programming | |||
Determine if folder exists | Excel Programming | |||
If A Directory Exists | Excel Programming | |||
How does Excel determine the TEMP directory? | Excel Programming |