Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Alex,
If you don't specify that you're looking for a directory, Dir() will return the name of the first file found in that folder. So in this case, I'm assuming that D:\temp\alex\ contains at least one file and that D:\temp\ only contains folders. You could use this instead: If Len(Dir$("D:\temp\alex\", vbDirectory)) Then and If Len(Dir$("D:\temp\", vbDirectory)) Then These statements should return True if the folders exist and False if they don't exist. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Alex St-Pierre wrote: Hello, The Dir function doesn't work all the time example: If Dir("D:\temp\alex\") = "" Then exit sub endif the macro doesn't stop because the repertory is valid and then, I try: If Dir("D:\temp\") = "" Then exit sub endif and the macro stop ? It's very strange, the drive used is a server drive but always available. Finally, I tried: path = "D:\temp\" ChDrive path ChDir path If Dir(path) = "" Then exit sub endif ChDrive and ChDir change but the macro stop ?? Any idea ? Thanks, |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
problem with Linking workbooks via "copy" and "paste link" | Excel Discussion (Misc queries) | |||
Drawing Diagonal Lines "Refresh" problem - Any suggestions | Excel Discussion (Misc queries) | |||
Problem with "On error resume next" with "custom VLookup" | Excel Programming |