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.
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

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??
 

Watch MrExcel Video

Forum statistics

Threads
1,123,530
Messages
5,602,200
Members
414,513
Latest member
junbuggle

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