"DIR" Command not working

Mackeral

Board Regular
Joined
Mar 7, 2015
Messages
249
Office Version
  1. 365
Platform
  1. Windows
Using Office 365 Excel

I enter into Immediate Box
Code:
Dir ("E:")
and I get back "180601 Temp RIBBON CALLS.BAS" which isn't even a file in E:.

I add
Code:
Dir ("E:*.*)"
and I get bck the same thing.

If I use
Code:
Dir("E:*.Bat")
Nothing shows but there is one "*.Bat" file in the directory.

Any idea of what's going on here?

Thanks,
Mac
 
Last edited:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
For sure you're going to have a problem because you are missing the \
 
Upvote 0
When I do "Dir("c:\Program Files")", i get back is "- Program Files.lnk". And
"C:\*.* "
gives back
".crusader"
when there are 3 other files there.

It use to give me a list of all the files. What's happening?

But thanks for the reply.
Mac
 
Upvote 0
Dir only gives you 1 file at a time. To see all of them, you need to use it in a loop, like this:

Code:
    str1 = Dir("C:\Folder\*.*")
    While str1 <> ""
        Debug.Print str1
        str1 = Dir()
    Wend
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top