Dos Command

T

Trever B

I am trying to run dir e:\ *.xls /b/s > e:\fdirdata.txt within access.

I am not having much sucess.

Please help
 
W

Wayne Morgan

Try

Shell "command.com /c dir e:\*.xls /b/s >e:\fdirdata.txt"

Shell is a VBA function that allows you to run external programs, in this
case command.com. The /c switch tells command.com to run the specified
command, in this case the dir command, then exit.
 
T

Trever B

Wayne thanks for reply. However the file has be shortended with ~ how can I
get full file & directory names

Thanks for your help
 
W

Wayne Morgan

If you're using a Windows NT computer (this includes Win2k and WinXP) then
use cmd.exe instead of command.com. You can also use the VBA Dir() function
and the VBA file manipulation functions to write your own file.
 
Top