Using VBA's Dir function this way: Dir Nul

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MLH

    Using VBA's Dir function this way: Dir Nul

    Trying to understand what VBA is telling me when running
    Dir c:\thisdir\that subdir\nul

    I did the following in a command window:

    C:\Docs\TitleWo rk>cd\

    C:\>dir nul

    Directory of \\.

    File Not Found

    C:\>

    So, what exactly is DOS telling me here? I'm sure VBA is
    taking the reply and interpreting it somehow. What is special
    about nul (very different from null)? Try dir null in a command
    window and you'll see.
  • Cagey

    #2
    Re: Using VBA's Dir function this way: Dir Nul

    I think it may be checking to see if a directory exists

    The "usual" way to check for the existence of a directory (no matter if it
    has a dot in the name) is to check for the nul device inside it.

    for example in a batch file
    if exist any.dir\nul ECHO YES

    "MLH" <CRCI@NorthStat e.netwrote in message
    news:84e904tg5s ailrs8g4tvpvuaa 1lnujn87g@4ax.c om...
    Trying to understand what VBA is telling me when running
    Dir c:\thisdir\that subdir\nul
    >
    I did the following in a command window:
    >
    C:\Docs\TitleWo rk>cd\
    >
    C:\>dir nul
    >
    Directory of \\.
    >
    File Not Found
    >
    C:\>
    >
    So, what exactly is DOS telling me here? I'm sure VBA is
    taking the reply and interpreting it somehow. What is special
    about nul (very different from null)? Try dir null in a command
    window and you'll see.

    Comment

    • MLH

      #3
      Re: Using VBA's Dir function this way: Dir Nul

      Well that works for me.

      Many thanks, Keith.

      Comment

      Working...