VB6 - Sorting 3000 MsWord Documents.

Hi,

I have 3000 MsWord Documents named from 1.rtf to 3000.rtf.
I would like to put the numbers names in Access data base table to trace them. If one of them is missing (let say 1756.rtf - has been deleted... ) to get a MsgBox "The file 1756 is missing".

Any idea?

Thanks,
Angel
LVL 2
2AngelAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ADSaundersCommented:
Hi 2Angel,

Dim fs As Scripting.FileSystemObject, i As Integer
Set fs = New Scripting.FileSystemObject
For i = 1 To 3000
    If fs.FileExists("C:\files\" & CStr(i) & ".rtf") Then
        ' here you add code for creating the database
    Else
        MsgBox "C:\files\" & CStr(i) & ".rtf -- FILE IS MISSING"
    End If
Next
Set fs = Nothing

Regards .. Alan

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GrahamSkanRetiredCommented:
get the list of files into a txt document:

MyFile = Dir$(MyPath & "\*.rft)
Open "MyList.txt" for output as #1
do until MyFile = ""
Print #1,MyFile
MyFile = Dir$()
Loop

Open this in Word
Select all & convert to a table
Select table & copy & paste into a single-field Access table
GrahamSkanRetiredCommented:
Or you could import the txt file directlly into Access
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

2AngelAuthor Commented:
Thank you for the quick reply.


Is it possible to put first al the number in the table (I don't know to do it) and then to go over the numbers to check if there is a missing number between MinNumber and MaxNumber?


Thanks again,
Angel
jbaisdenCommented:
This is the first question that I think I can answer. 2Angel, I have a solution nearly fully developed. It includes a whole vb 6 project with an Access 2000 mdb file. It also has error checking. I'm kind of doing the whole thing for you and don't know if that's what you want; if not, my apologies. However, this is my first chance to give back something to this community and I just really want to. The code will be lengthy so if you'll post your email address I'll send it to you when I'm done. Hopefully you'll have all the references (stuff for OLE DB, ms scripting runtime, microsoft jet--though i'm not sure if i actually need a reference to this one). Anyhow, just thought I'd let you know in case you accepted an answer. I'm not all that worried about points. I would like you to take a look at the solution once I finish it though, if you don't mind.

jbaisdenCommented:
I have the solution complete 2Angel. You may email me at jbaisden@natcominc.com or jabcsmajor@jam.rr.com

I tried to make it as modular as possible. The database file has 3 fields and 1 table. They should be self explanatory. Here is a list of project references:

Project References:

OLE Automation
Microsoft ActiveX Data objects 2.7 library
Microsoft Jet and replication objects 2.6 library
Microsoft Scripting Runtime

Components:
Microsoft Common Dialog Control 6.0

Like I said earlier, though the points would be nice, I am more interested in you looking at my solution. I took a roundabout way on a few things but the solution works out quite nicely with error handling and code that I think is highly reusable.

Anybody else interested in the code give me an email. I open for constructive criticism. I certainly could use it.
2AngelAuthor Commented:
jbaisden: Thank you very much!!!
I have sent you my e-mail address to your mail......

c u ...........
jbaisdenCommented:
The email has been sent. I hope it is everything you need. If it lacks anything at all let me know and I will see what I can do. I have put in comments so as to let you know exactly what I am doing. I hope they make sense. Constructive criticism is welcome.

Jbaisden
2AngelAuthor Commented:
Dear jdaisden:

I am sorry but was out of the office for few days..... I didn't had the time to check your code.... I will do it tomorrow and will let you know...............


Best regards,
Angel
2AngelAuthor Commented:
I am sorry to tell you, but it's not working.
It has many error messages which I don't know what to do with them and an error message about "licens".....

It's seems to me that this code was coming from a different source.....


Thanks, but no thanks......!!!!


Angel
jbaisdenCommented:
I can understand if you don't want the code. I have no clue what errors you might be getting because it works fine for me. However, the insinuation that the code isn't mine I really don't appreciate. Suit yourself.

Jbaisden
jbaisdenCommented:
Some things to think about:

I was using VB 6.0 SP 5 (OS: Win 2000) at first and finished the project just on VB 6.0 (XP PRO). I had used Access 2000 to create the database. I had no trouble accessing the .mdb file on my computer at home, even though Access was not installed.

Those are really the only things I can think of that would have caused problems. I guess check and made sure the read-only property is not checked on the .mdb file.

For what you want to do there is ample code on this page already, plus my code. Even if the project doesn't run, you should be able to read the files fine and see my comments and the code. I wish I had coded it like ADSaunders did above, but I didn't look at the code written by the people on this site until after I finished the project; hence, my immense aggrevation when you insinuated that the code was from another source.

The ADO recordset and accessing the database code is common stuff. You can't copy write that when Microsoft releases it for free.

The lot of the project is basic DB accessing and retrieval. The processing logic is my own. That isn't to say I'm the first to do it like that, but I am saying that I did not receive help with it.

In short, you owe me an apology. I put 8 hours of work into that code. An experienced programmer would have only needed 30 min to 1 hour. I admit that I am not; however, I am still a programmer and I stuck with it to the end. Take the code and do what you will. I have received my gratification from this exercise. I will end this comment now before I make remarks I shouldn't make.

Jbaisden
2AngelAuthor Commented:
The zip file you'v sent came with a stamp of VB programers WebSite................
2AngelAuthor Commented:
modulo: Thank you for your comment.

The 2 first solution are nice but I was looking for a more generic solution as I said in my first comment posted at 11/28/2003 03:25PM GMT.

If there is no more to 'say' from ADSaunders & GrahamSkan I will split the point between them just to be fair.....

What do you think about it?


Angel
2AngelAuthor Commented:
Thanks again for evrey thing.............
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.