Hi,
I need help in writing a VB6 program to read 1000 word documents and extract my required information into a .dbf file.
All word documents are having different information in a tabular form but the following fields are common in all of them:
Name, Address, City, Country, Telephone, Mobile, Fax, Email, Title, Remarks
I want to extract these fields with their information and append them into my master Address.dbf file
Thanks & Best Regards,
Farooqui
4 2620
I'm new to this vb stuff myself, although i am sure it isnt possible to read data from word files.
I could be wrong however.
Hi,
I need help in writing a VB6 program to read 1000 word documents and extract my required information into a .dbf file.
All word documents are having different information in a tabular form but the following fields are common in all of them:
Name, Address, City, Country, Telephone, Mobile, Fax, Email, Title, Remarks
I want to extract these fields with their information and append them into my master Address.dbf file
Thanks & Best Regards,
Farooqui
i know you're writing in vb6 and this is vba, but it can probably help you along the way.
to handle word files, you will need to import the reference library "Microsoft Word 11.0 Object Library". you will also need to declare a word application. - Dim appWord As New Word.Application
to loop through the files, use a file system object to find the file names of e.g. all word documents in a user-specified folder. then open them using - appWord.visible = false
-
appWord.Documents.Open(strFullFilePath)
if the table has the same structure in every document, and also the same orientation in relation to other tables (first or third table in each document, for example...), you can use the following code to access the data in the tables and place it in an array. i will use the fields Name and Address and assume they are located in the first and second columns of the first table in each document. - Dim index,intNameCol,intAddressCol,row As Integer
-
Dim strName As String
-
-
' Given that the info for each person is located in the first column of the first table in each document
-
index = 1 ' table index within the document
-
intNameColl = 1
-
intAddressColl = 2
-
-
' Get the table from word
-
Dim tblItems As Word.Table
-
Set tblItems = appWord.ActiveDocument.Tables(index)
-
-
' Define a multidimensional array to keep the data. Do this outside of the loop to get word documents if you wish to get all the data before putting it in the database.
-
Dim arrData() As String
-
-
' Loop through the table to get all names
-
For row = 1 To tblItems.Rows.Count
-
ReDim Preserve arrData(1 To 2, 1 To UBound(arrData, 2)) ' Adds another row to the array, no matter what size it is currently.
-
-
arrData(1,row) = tblItems.Cell(row,intNameCol) ' gets Name
-
arrData(2,row) = tblItems.Cell(row,intAddressCol) ' gets Address
-
Next
as to putting everything in the database, i am not familiar with the database format you're using, and can therefore not help you with that part.
i know you're writing in vb6 and this is vba, but it can probably help you along the way.
to handle word files, you will need to import the reference library "Microsoft Word 11.0 Object Library". you will also need to declare a word application. - Dim appWord As New Word.Application
to loop through the files, use a file system object to find the file names of e.g. all word documents in a user-specified folder. then open them using - appWord.visible = false
-
appWord.Documents.Open(strFullFilePath)
if the table has the same structure in every document, and also the same orientation in relation to other tables (first or third table in each document, for example...), you can use the following code to access the data in the tables and place it in an array. i will use the fields Name and Address and assume they are located in the first and second columns of the first table in each document. - Dim index,intNameCol,intAddressCol,row As Integer
-
Dim strName As String
-
-
' Given that the info for each person is located in the first column of the first table in each document
-
index = 1 ' table index within the document
-
intNameColl = 1
-
intAddressColl = 2
-
-
' Get the table from word
-
Dim tblItems As Word.Table
-
Set tblItems = appWord.ActiveDocument.Tables(index)
-
-
' Define a multidimensional array to keep the data. Do this outside of the loop to get word documents if you wish to get all the data before putting it in the database.
-
Dim arrData() As String
-
-
' Loop through the table to get all names
-
For row = 1 To tblItems.Rows.Count
-
ReDim Preserve arrData(1 To 2, 1 To UBound(arrData, 2)) ' Adds another row to the array, no matter what size it is currently.
-
-
arrData(1,row) = tblItems.Cell(row,intNameCol) ' gets Name
-
arrData(2,row) = tblItems.Cell(row,intAddressCol) ' gets Address
-
Next
as to putting everything in the database, i am not familiar with the database format you're using, and can therefore not help you with that part.
Thankyou very much for your help. Its Ok, I will switch from VB6 to VBA that doesn't matter. I would really appreciate if you could guide me for the second part as well. My database is in DBF and its format is:
Name String 50
Address String 75
Email String 50
......
One more query I would like to know that in some of my word documents, the sequence is litthe different means I can't use array to get the exact rows location, means Name is sometimes at row 4 and Address is at row 1. How should I handle this?
Thanks once again
& Best Regards
Farooqui.
QVeen72 1,445
Recognized Expert Top Contributor
Hi,
How do u come to know that name is in 4th or 5th row..? does it have any Prefix Chars...? (say Mr. Ms....? Name..) if yes, then u can check for that Specific Word and take accordingly..
REgards
Veena
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ruby Tuesday |
last post by:
Hi, I was wondering if expert can give me some lite to convert my word table
into access database.
Note: within each cell of my word table(s), some has multi-line data in it.
In addition, there is one row containing picture(s) as well.
So far, what I did is doing it manually for each word docs I have.
Select Table
Convert Table to Text(I use ^ character for delimiter)
|
by: Otis Hunter |
last post by:
I have been given an Access Database which contains a table that has
an OLE object field that contains a Word document. That table contains
hundreds of records. I would like to find out how I can write a VB
script, to be executed either within Access or executed at the CMD
prompt, which will loop through all the records and open the document
object and save it to a Word document that I can access from Windows
Explorer. An additional info...
|
by: Derek |
last post by:
I have a simple app that logs details of my customers and the work done for
them. It uses a few tables in Access and allows me to keep a basic record of
things for my accountant.
How can I output the billing info from my app to the Word doc or maybe Excel
spreadsheet? I can gather all the info I need from a query but I have
trouble sticking into a word document so the info is placed in the correct
places in it. ie: name, address, billing...
|
by: leo2100 |
last post by:
Hi, I need help with this program. The program is supposed to take a
text file and identify the words in it, then it should print them and
count how many times a word is repeated. At first main called the
function wordcount, and then the function did everything including
printing out the results. That worked. Now I want to make the function
return an array of pointers to struct palabra so the calling function
can manage the data as it...
|
by: genestarwing |
last post by:
QUESTION:
Write a program that opens and read a text file and records how many
times each word occurs in the file. Use a binary search tree modified
to store both a word and the number of times it occurs. After the
program has read the file, it should offer a menu with three choices.
the first is to list all the words along with the number of occurences.
The second is to let you enter a word, with the program reporting how
many times the...
| |
by: skumar434 |
last post by:
i need to store the data from a data base in to structure
.............the problem is like this ....suppose there is a data base
which stores the sequence no and item type etc ...but i need only the
sequence nos and it should be such that i can access it through the
structure .plz help me .
|
by: raypjr |
last post by:
Hi everyone. I need a little help with some parts of a word guessing game I'm working on. I have some parts done but unsure about others and could use a little advice. Any help is very much appreciated.Here is the code to give more detail:
Dim GameOver As Boolean
Dim NumWords As Integer, ThreeWordList(1000) As String, ThreeWordMeaning(1000) As String
Dim R As Integer, WordsLeft(1000) As Integer
Dim SecretWord As String,...
|
by: gunimpi |
last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431
********************************************************
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
wanted
********************************************************
For this teeny job, please refer to:
http://feeds.reddit.com/feed/8fu/?o=25
|
by: cj2 |
last post by:
I need to create a cover letter in VB. It will have a customers account
number at the top and be addressed to them by name for example (Dear Mr.
Smith). After this it will be the same text for each customer.
This letter is a reminder to pay an invoice and it needs to be merged in
front of an existing pdf document which is the unpaid invoice the
customer was sent previously. The result of the merger of this reminder
letter and the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |