VB Question

davidhall80

Well-known Member
Joined
Jul 8, 2006
Messages
663
I get a data dump of 70 text files each week. I then run a batch to combine them and open it up in excel. The only problem is some of the 70 files don't always come thorough. If I am supposed to have the following 6 txt files dumped into my drive each week.

david.txt
Sally.txt
Micheal.txt
Robin.txt
Jack.txt
Jill.txt

But only david.txt, Sally.txt, & Jill.txt come through. Can I write in VB to tell me that Micheal.txt, Robin.txt, & Jack.txt weren't part of my batch. Maybe a message box or something....Thanks in advance....The search of course would be on the names of the txt files in a folder called "Data Dump" on my desktop.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
Not really sure what you wanted though....
Code:
Sub test()
Dim myDir As String, e, msg As String
myDir = CreateObject(WScript.Shell").SpecialFolders("Desktop") & "\Data Dump\"
For Each e In Array("david","Sally","Micheal","Robin","Jack","Jill")
     If Dir(myDir & e & ".txt") = "" Then msg = msg & e & ".txt" & vbLf
Next
MsgBox IIf(Len(msg)>0, "Missing" & vbLf & msg, "All files are in the folder")
End Sub
 

davidhall80

Well-known Member
Joined
Jul 8, 2006
Messages
663
For this line of code....I'm getting this message "Compile Error: Expected: list separator or)"


myDir = CreateObject(WScript.Shell").SpecialFolders("Desktop") & "\Data Dump\"


Any ideas??
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,282
Messages
5,836,392
Members
430,425
Latest member
xlsee

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
Top