Solved

VB6 - Sorting 3000 MsWord Documents.

Posted on 2003-11-28
17
359 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 2
  • +1
17 Comments
 
LVL 10

Accepted Solution

by:
ADSaunders earned 75 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 25 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 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