Link to home
Start Free TrialLog in
Avatar of lakshini
lakshini

asked on

manipulating word documents

Hi,
I'm trying to build an application which can summarize word documents.
Does anyone know how I can access specific words whithin a word document and place those extracted words in a temproary file ?
Cheers!!
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Hi,

What do you mean by summarize word documents?
Avatar of lakshini
lakshini

ASKER

say you  have a 10 page document, I'm trying to condense it to 1 page by extracting the main concepts of the document
Table of Content?
just thought that I'd add some more information....in order to create the summary of a large microsoft word based document I will have to use some statistical algorithms.
One such algorithm will be used to count the frequency of words...but to do this I don't know how to access individual words in a MS Word document..That's basically my problem:
How do i access individual words in MS word document so that I can manipulate it as I please?
This is a short example on how you can get at the body text of a word document... add a reference to Microsoft Word object (where the file is c:\temp\mydoc.doc)

Private Sub Command1_Click()
   
    Dim obj As Word.Application
    Dim strString As String
   
    Set obj = New Word.Application
   
    obj.ChangeFileOpenDirectory "c:\temp\"
    obj.Documents.Open FileName:="mydoc.doc", ConfirmConversions:=False, ReadOnly:= _
        False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _
        "", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _
        Format:=wdOpenFormatAuto
   
    obj.Selection.WholeStory
   
    strString = obj.Selection
   
    Text1.Text = strString
   
    obj.ActiveDocument.Close
   
    Set obj = Nothing
   
End Sub

If you want to post a bit more info.. see if I can help more..

Hope that helps.
R
..you will then need to write a function to search through this text (strString)... either using the function of the word object or using your own function...

R
NO!! :) not table of contents...say u received a 200 page document and also assume that u didn't have time to read the entire document...wouldn't it be nice if u could get an overall idea of the document?...basically an abstract...that's what i'm trying to do!
..you will then need to write a function to search through this text (strString)... either using the function of the word object or using your own function...

R
Hi R,
I'm actually a newbie to VB, so to understand the code that u gave me, I'll have to do some referencing...any ideas as to what areas in VB i should look into??....another question when the document is assigned to a string, can i specify the location of a word i want to extract?
ASKER CERTIFIED SOLUTION
Avatar of rallsaldo
rallsaldo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey R!!,
I just did a bit of surfing and realized that there was a "word object"...i wasn't aware of it since i'm new to VB.
Since u provided me with some direction i'm going to accept ur comment as answer!...i'll post another question when i get stuck!...thanks again :)
okay thanks glad i could help...

the word/excel/etc objects are quite powerful and can let you do some flashy stuff...

Cheers,
R