Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB6 - Sorting 3000 MsWord Documents.

Posted on 2003-11-28
17
Medium Priority
?
360 Views
Last Modified: 2010-05-03
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
Comment
Question by:2Angel
  • 7
  • 5
  • 2
  • +1
17 Comments
 
LVL 10

Accepted Solution

by:
ADSaunders earned 225 total points
ID: 9837792
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
 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 75 total points
ID: 9837808
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
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 9837821
Or you could import the txt file directlly into Access
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:2Angel
ID: 9838200
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
 

Expert Comment

by:jbaisden
ID: 9838626
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
 

Expert Comment

by:jbaisden
ID: 9840685
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
 
LVL 2

Author Comment

by:2Angel
ID: 9845145
jbaisden: Thank you very much!!!
I have sent you my e-mail address to your mail......

c u ...........
0
 

Expert Comment

by:jbaisden
ID: 9848159
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
 
LVL 2

Author Comment

by:2Angel
ID: 9869531
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
 
LVL 2

Author Comment

by:2Angel
ID: 9876147
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
 

Expert Comment

by:jbaisden
ID: 9876209
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
 

Expert Comment

by:jbaisden
ID: 9876486
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
 
LVL 2

Author Comment

by:2Angel
ID: 9877097
The zip file you'v sent came with a stamp of VB programers WebSite................
0
 
LVL 2

Author Comment

by:2Angel
ID: 9877441
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
 
LVL 2

Author Comment

by:2Angel
ID: 9878051
Thanks again for evrey thing.............
0

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question