View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default dos from excel vba?

In general, you can use Shell to issue DOS commands--even call other programs.

But VBA has lots of stuff to work with files and folders built in.

Including
chdrive (to change drives)
chdir (to change folders)




dim OldPath as String
dim NewPath as string

OldPath = CurDir
newpath = "D:\somefolder"
chdrive newpath
chdir newpath

'do a lot of work and change back

chdrive oldpath
chdir oldpath




Jason wrote:

hi, is there any way that i could open and enter commands in ms dos
controlling from excel vba code?, like, say i wanted to change the current
directory in msdos from d: to c:, is there anyway that i could do it from
excel vba? if so, could you give me a hint..


--

Dave Peterson