• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 365
  • Last Modified:

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
0
2Angel
Asked:
2Angel
  • 7
  • 5
  • 2
  • +1
2 Solutions
 
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
0
 
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
0
 
GrahamSkanRetiredCommented:
Or you could import the txt file directlly into Access
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
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
0
 
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.

0
 
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.
0
 
2AngelAuthor Commented:
jbaisden: Thank you very much!!!
I have sent you my e-mail address to your mail......

c u ...........
0
 
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
0
 
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
0
 
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
0
 
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
0
 
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
0
 
2AngelAuthor Commented:
The zip file you'v sent came with a stamp of VB programers WebSite................
0
 
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
0
 
2AngelAuthor Commented:
Thanks again for evrey thing.............
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 7
  • 5
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now